Skip to content

Undefined array key "cursor" #66

Closed
Closed

Description

@thekid

This error was occurring on dialog this morning:

Error web.Error(#500: Undefined array key "cursor")
  at web.frontend.Exceptions::handle() [line 105 of Frontend.class.php]
  at web.frontend.Frontend::view() [line 138 of Frontend.class.php]
  at web.filters.Invocation::proceed() [line 59 of BehindProxy.class.php]
  at web.filters.Invocation::proceed() [line 41 of Filters.class.php]
  at web.Filters::handle() [line 90 of Application.class.php]
  at xp.web.srv.HttpProtocol::handleData() [line 64 of Kernel.class.php]
  at peer.server.AsynchronousServer::{closure:peer\server\AsynchronousServer::select():74}() [...]
  at peer.server.AsynchronousServer::service() [line 109 of Kernel.class.php]
  at xp.web.srv.Standalone::serve() [line 81 of Runner.class.php]
  at <main>::__error() [line 314 of Collection.class.php]
  at com.mongodb.Collection::first() [line 136 of Repository.php]
  at de.thekid.dialog.web.Home::index() [line 0 of StackTraceElement.class.php]

The relevant lines where this exception comes from:

$commands= Commands::reading($this->proto);
$result= $commands->send($options, $sections);
return new Cursor($commands, $options, $result['body']['cursor']);

This means there is a body but it does not contain a cursor, which for the find or aggregate command issue cannot happen looking at the protocol; except maybe if it somehow became out of order; or if one of the cluster nodes points to something which replies with something "don't connect nere any longer" or something. Unfortunately, I couldn't reproduce this locally, and changing the server to use more verbose debugging is not possible without losing connections.

This protocol error should lead to the MongoDB client to disconnect, re-evaluate the cluster setup and subsequently reconnect. Restarting the Docker container did the trick, so I assume this would also work.

Activity

  1. thekid commented on Jul 10, 2026

    @thekid
    MemberAuthor

    Seems to happen in some case of weird cluster reorganization / reconnect scenario.

  2. added theissue type on Jul 11, 2026
  3. thekid commented on Jul 12, 2026

    @thekid
    MemberAuthor

    Together with #67 and #68, this should now lead to a "packet out of order" protocol error and a subseqent re-connect. Queries will be retried.

  4. thekid commented on Jul 12, 2026

    @thekid
    MemberAuthor

    Integration testing started on https://dialog.friebes.info/, which has been upgraded to https://github.com/xp-forge/mongodb/releases/tag/v3.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions