[JAVA-304] Problem with closing cursors - killCursors Created: 24/Mar/11  Updated: 19/Oct/16  Resolved: 24/Mar/11

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: 2.5
Fix Version/s: 2.5.2

Type: Bug Priority: Major - P3
Reporter: Ryan Nitz Assignee: Antoine Girbal
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Tested on 1.8.0, 1.7.4 and 1.6.5.



 Description   

The following group of messages are causing a lot of noise in the mongod logs (it displays over and over).

I tested the same code with an older version of the driver and it didn't display these messages in the mongod log.

------------------------- mongoniff:

query:

{ cid: ObjectId('4d1b6314e528c81a1f200e03') }

ntoreturn: 0 ntoskip: 0 127.0.0.1:27017 <<-- 127.0.0.1:52976 1766 bytes id:581d98b8 1478334648 - 3700

reply n:10 cursorId: 0

{ _id: "Rnz4c.local-f65b47db16df8f14d7e5aec03a308614-4d1b6314e528c81a1f200e03", adr: "0:0:0:0:0:0:0:1%0", ahn: "Rnz4c.local", cid: ObjectId('4d1b6314e528c81a1f200e03'), lu: 1300932926583, p: false, uc: 150 }

127.0.0.1:52976 -->> 127.0.0.1:27017 32 bytes id:e75 3701 killCursors n: 1

------------------------- mongod log:

killcursors: found 0 of 1
Wed Mar 23 23:28:58 [conn25] killcursors: found 0 of 1
Wed Mar 23 23:28:59 [conn25] killcursors: found 0 of 1
Wed Mar 23 23:29:03 [conn25] killcursors: found 0 of 1
Wed Mar 23 23:29:04 [conn25] killcursors: found 0 of 1
Wed Mar 23 23:29:08 [conn25] killcursors: found 0 of 1
Wed Mar 23 23:29:09 [conn25] killcursors: found 0 of 1
Wed Mar 23 23:29:13 [conn25] killcursors: found 0 of 1
Wed Mar 23 23:29:14 [conn25] killcursors: found 0 of 1
Wed Mar 23 23:29:18 [conn25] killcursors: found 0 of 1
Wed Mar 23 23:29:19 [conn25] killcursors: found 0 of 1
Wed Mar 23 23:29:23 [conn25] killcursors: found 0 of 1
Wed Mar 23 23:29:24 [conn25] killcursors: found 0 of 1
Wed Mar 23 23:29:28 [conn25] killcursors: found 0 of 1
Wed Mar 23 23:29:29 [conn25] killcursors: found 0 of 1
Wed Mar 23 23:29:33 [conn25] ClientCursor::find(): cursor not found in map 0 (ok after a drop)



 Comments   
Comment by Scott Hernandez (Inactive) [ 24/Mar/11 ]

Antoine, is that it, can we close it? I am going to do a 2.5.2 release for this.

Comment by Antoine Girbal [ 24/Mar/11 ]

just pushed a fix for closing id that are negative.
the condition was not correct in several places (including getMore())

Comment by auto [ 24/Mar/11 ]

Author:

{u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}

Message: JAVA-304: cursors with negative id were not being closed
https://github.com/mongodb/mongo-java-driver/commit/4b7f909a1707ea4803565f1a11f2822f043c87aa

Comment by Antoine Girbal [ 24/Mar/11 ]

the problem here is that in killCursor() driver will kill cursor as long as id >= 0.
But id of 0 means that cursor does not exists.
With driver 2.5 it will automatically close cursor when limit is reached, and then if client calls close() it will do another killCursor on id 0.
fixed by changing condition to be id > 0

Comment by auto [ 24/Mar/11 ]

Author:

{u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}

Message: JAVA-304: Problem with closing cursors - killCursor may try to close a cursor of id 0
https://github.com/mongodb/mongo-java-driver/commit/8f9b11eed55171e9dc07a9938b1f0f0834192d67

Generated at Thu Feb 08 08:51:58 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.