[JAVA-1165] Some DBCursor array methods may not close underlying cursor Created: 10/Apr/14  Updated: 01/Aug/14  Resolved: 16/Apr/14

Status: Closed
Project: Java Driver
Component/s: Query Operations
Affects Version/s: 2.12.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: John Morales Assignee: John Morales
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

It appears that 4 methods exposed on DBCursor have the potential to not have the underlying cursor closed in the event of an IO error.

  • itcount()
  • length()
  • toArray()
  • toArray(int)

Note that exhausting a cursor causes the server-side cursor to be closed. Therefore on the one hand, 3 out of 4 methods above are fine on the happy path, and are only exposed in the case of an IO error. However toArray(int) is more risky, since in this case the cursor may not be exhausted, either, depending on the int argument value and length of the result set.



 Comments   
Comment by Githook User [ 01/Aug/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1165: Also backing out the test
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/726354c3490381a5dad105e546b9611249d88416

Comment by Githook User [ 01/Aug/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1165: Backing this change out, after deciding it's too risky to close the cursor before it's fully consumed
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/79a8b3e307bc80da16f6aaa0d2463ac30387eaa9

Comment by Githook User [ 01/Aug/14 ]

Author:

{u'username': u'john-morales', u'name': u'John Morales', u'email': u'john.morales@10gen.com'}

Message: JAVA-1165 ensure array and itcount methods always close cursor server side even on IO error
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/ac2242842b0c6399f7476f28e300fe45535a4714

Comment by Githook User [ 25/Apr/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1165: Also backing out the test
Branch: 2.12.x
https://github.com/mongodb/mongo-java-driver/commit/726354c3490381a5dad105e546b9611249d88416

Comment by Githook User [ 16/Apr/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1165: Backing this change out, after deciding it's too risky to close the cursor before it's fully consumed
Branch: 2.12.x
https://github.com/mongodb/mongo-java-driver/commit/79a8b3e307bc80da16f6aaa0d2463ac30387eaa9

Comment by Jeffrey Yemin [ 16/Apr/14 ]

Backed out the change, after discussing and determining it's too risky.

Comment by Jeffrey Yemin [ 16/Apr/14 ]

Need to merge this in to 3.0.x branch

Comment by Githook User [ 16/Apr/14 ]

Author:

{u'username': u'john-morales', u'name': u'John Morales', u'email': u'john.morales@10gen.com'}

Message: JAVA-1165 ensure array and itcount methods always close cursor server side even on IO error
Branch: 2.12.x
https://github.com/mongodb/mongo-java-driver/commit/ac2242842b0c6399f7476f28e300fe45535a4714

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