Java Driver
  1. Java Driver
  2. JAVA-304

Problem with closing cursors - killCursors

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major - P3 Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.5.2
    • Component/s: None
    • Labels:
      None
    • Environment:
      Tested on 1.8.0, 1.7.4 and 1.6.5.
    • Operating System:
      ALL
    • # Replies:
      5
    • Last comment by Customer:
      false

      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)

        Activity

        Hide
        auto
        added a comment -

        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

        Show
        auto
        added a comment - 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
        Hide
        Antoine Girbal
        added a comment -

        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

        Show
        Antoine Girbal
        added a comment - 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
        Hide
        auto
        added a comment -

        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

        Show
        auto
        added a comment - 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
        Hide
        Antoine Girbal
        added a comment -

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

        Show
        Antoine Girbal
        added a comment - just pushed a fix for closing id that are negative. the condition was not correct in several places (including getMore())
        Hide
        Scott Hernandez
        added a comment -

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

        Show
        Scott Hernandez
        added a comment - Antoine, is that it, can we close it? I am going to do a 2.5.2 release for this.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since reply:
              3 years, 4 weeks ago
              Date of 1st Reply: