MongoDB杀死了不朽的游标

时间:2017-11-30 10:47:21

标签: php mongodb cursor

我正在使用PHP mongodb / mongodb驱动程序v 1.1.2

低级驱动程序信息:

mongodb version => 1.1.7
mongodb stability => stable
libmongoc version => 1.3.5
libbson version => 1.3.5

MongoDB 3.4.7和3.4.10

连接选项:

socketTimeoutMS=3600000

光标选项:

maxTimeMs: 360000
noCursorTimeout: true

所以我假设光标必须是不朽的

程序正常运行,然后崩溃并出现以下错误:

[29-Nov-2017 15:23:04 UTC] PHP Fatal error:  Uncaught MongoDB\Driver\Exception\RuntimeException: Cursor not found (namespace: 'xxxx.yyyy', id: 6220790657981310420).

在mongos日志中,我看到了

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

请注意"闲置"所有行的时间戳都相同。我很确定该程序正在从该游标中主动获取数据。

我没有创建游标的确切时间,但它发生的时间不早于15:03:35。

这个问题非常罕见。我有很多活跃的游标,其中一些游戏可以存活数小时。这一个在20分钟后被清理干净了

1 个答案:

答案 0 :(得分:1)

唯一支持的集合选项是

  • readConcern
  • readPreference
  • 类型映射
  • writeConcern

DocsRef

maxTimeMSnoCursorTimeout Cursor 的选项。您需要在find()和类似命令中传递它们。

DocsRef