[JAVA-2039] Subscription.request throws exception when state is open Created: 17/Nov/15 Updated: 13/Apr/16 Resolved: 13/Apr/16 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Async |
| Affects Version/s: | None |
| Fix Version/s: | 3.2.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Michal B. | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
I'm working with Reactive Streams driver and Akka Streams. In my application I have stream which iterates over collections and databases.
It looks like error from closed BatchCursor is not emitted as onError but thrown in Subscription.request. Unfortunately I can't reproduce this BatchCursor problem with test (I'm not sure why cursor was closed). But the same problem can occur when I try to run stream on publisher created from closed mongo client. |
| Comments |
| Comment by Ross Lawley [ 10/Dec/15 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks michalbogacz@gmail.com, Good news, I'm marking this as fixed as I believe the protection we put in will make the errors described call the onError callback. Thanks for you help on this ticket. Ross | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michal B. [ 10/Dec/15 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
I upgraded driver to newest version. I didn't saw this problem since last time I reported it. Thank you for your help. Best regards, | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ross Lawley [ 01/Dec/15 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
I think I'll await any further information about the cause of the closed cursor before proceeding further on this ticket. | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michal B. [ 26/Nov/15 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Exactly the same error but not with version rc0. I upgraded driver to rc0 today. Michal | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ross Lawley [ 26/Nov/15 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks michalbogacz@gmail.com, just to double check was it the same batchCursor error? Also, did you upgrade to the rc0? Ross | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michal B. [ 25/Nov/15 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
I wrote last comment too early. The problem occurred today on one of our environments. | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michal B. [ 25/Nov/15 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Ross, Thank you for all support and sorry for taking your time. Best regards, | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ross Lawley [ 24/Nov/15 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
I've updated the Reactive Streams driver to ensure that the first case is handled - see JAVARS-15. It has been released in 1.2.0-rc0. I'd still like to understand why the cursor was closed and that resulting error before actioning this ticket. Ross | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michal B. [ 18/Nov/15 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
About first example: About second: My client configuration is: Other config it not changed. Michal | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ross Lawley [ 18/Nov/15 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks for the examples. The first example reproduces the issue - but is currently expected behaviour. You can't close the client and expect it to use it, although the notNull checks are done outside of callbacks, and potentially this could be improved upon. Your second example looks fine but something is closing the client and I'd like to understand that more, to see if there is another issue being hidden here. Please let me know if you can identify it in your tests. Does any other process have access to the client? Ross | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michal B. [ 17/Nov/15 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Ross, I managed to only reproduce similar problem with this (scala) code
result stacktrace:
This code doesn't prove batch exception but shows that violation of rule is possible. What I'm trying to get in my code is status of all collections in all databases. I can't show code because of restrictions but it bases on approach from below:
The environment where it runs is nondeterministic. It can change really fast (creating and removing databases and collections). I'm still trying to figure out why there is close on BatchCursor. Still even if something like this happen I would like to have my application resilient and not stop whole stream because of one error (and this error stops whole stream). | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ross Lawley [ 17/Nov/15 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks michalbogacz@gmail.com for the ticket. We're looking into it, can you provide an example of how you are using the BatchCursor? I'm trying to understand how it was closed in the first place and if that is an issue. Until the cursor is turned into a reactive stream by making it a Publisher, it does check its state and as you've seen it can throw exceptions certain expectations aren't met. Do you have any sample code reproducing this issue? Ross | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 17/Nov/15 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Moved to JAVA project until we determine that the issue is actually with the reactive streams code itself. |