[JAVA-2379] If closing a cursor throws, subsequent calls will throw java.lang.IllegalStateException Created: 09/Nov/16 Updated: 21/Nov/16 Resolved: 21/Nov/16 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Query Operations |
| Affects Version/s: | 3.3.0 |
| Fix Version/s: | 3.4.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Jackson Davis | Assignee: | Ross Lawley |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
If closing a QueryBatchCursor, if the first call throws it counts down a latch but does not set closed to true, meaning all subsequent calls throw an IllegalStateException.
I'm not sure whether or not this is expected behavior, but this is a regression from 2.13, where QueryResultIterator set closed=true before calling killCursor: https://github.com/mongodb/mongo-java-driver/blob/2.13.x/src/main/com/mongodb/QueryResultIterator.java#L176 (and we never observed this issue on 2.x) The obvious fix seems to be moving the closed=true into the finally block or before the try (as per 2.x), but I'm not sure what exactly the expected behavior is when calling close on the same cursor multiple times |
| Comments |
| Comment by Ross Lawley [ 21/Nov/16 ] | |||||||||||||
|
Thanks jcdavis for pointing this out, it is fixed in master and will be released as part of 3.4.0. | |||||||||||||
| Comment by Githook User [ 21/Nov/16 ] | |||||||||||||
|
Author: {u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}Message: Mark the QueryBatchCursor closed before calling killCursor This ensures if there is an error killing the cursor subsequent calls to the
| |||||||||||||
| Comment by Jackson Davis [ 09/Nov/16 ] | |||||||||||||
|
In case its of interest, here is the underlying exception that caused close to fail the first time. Doesn't seem super interesting to me though, just a mongod not being up
|