I'm using PHP mongodb/mongodb driver v 1.1.2
Low-level driver info:
mongodb version => 1.1.7
mongodb stability => stable
libmongoc version => 1.3.5
libbson version => 1.3.5
MongoDB 3.4.7 and 3.4.10
Connection options:
socketTimeoutMS=3600000
Cursor options:
maxTimeMs: 360000
noCursorTimeout: true
So I assume that cursor must be immortal
The program was running normally, then it crashed with the following error:
[29-Nov-2017 15:23:04 UTC] PHP Fatal error: Uncaught MongoDB\Driver\Exception\RuntimeException: Cursor not found (namespace: 'xxxx.yyyy', id: 6220790657981310420).
In mongos logs I see
2017-11-29T15:21:12.025+0000 I QUERY [ClusterCursorCleanupJob] Marking cursor id 6220790657981310420 for deletion, idle since 2017-11-29T15:11:11.139+0000
2017-11-29T15:21:16.026+0000 I QUERY [ClusterCursorCleanupJob] Marking cursor id 6220790657981310420 for deletion, idle since 2017-11-29T15:11:11.139+0000
2017-11-29T15:21:20.026+0000 I QUERY [ClusterCursorCleanupJob] Marking cursor id 6220790657981310420 for deletion, idle since 2017-11-29T15:11:11.139+0000
...
2017-11-29T15:22:56.029+0000 I QUERY [ClusterCursorCleanupJob] Marking cursor id 6220790657981310420 for deletion, idle since 2017-11-29T15:11:11.139+0000
2017-11-29T15:23:00.029+0000 I QUERY [ClusterCursorCleanupJob] Marking cursor id 6220790657981310420 for deletion, idle since 2017-11-29T15:11:11.139+0000
2017-11-29T15:23:04.029+0000 I QUERY [ClusterCursorCleanupJob] Marking cursor id 6220790657981310420 for deletion, idle since 2017-11-29T15:11:11.139+0000
Notice that "idle since" timestamp is identical for all lines. I am pretty sure that program was actively fetching data from that cursor.
I have no exact time when cursor was created, but it happened not earlier than 15:03:35.
The issue is very rare. I have lot of active cursors, some of them lives for hours. This one was cleaned up after 20 minutes
The only supported Collection options are
maxTimeMS
and noCursorTimeout
are options of the Cursor. You need to pass them in find()
and similar commands.