[JAVA-3852] InternalStreamConnection.openAsync leaks exception instead of passing it to callback Created: 07/Oct/20 Updated: 28/Oct/23 Resolved: 27/Nov/20 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Error Handling, Reactive Streams |
| Affects Version/s: | 3.12.7 |
| Fix Version/s: | 4.2.0, 3.12.8 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Sahil Anand | Assignee: | Jeffrey Yemin |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Description |
|
There seems to be a bug in
com.mongodb.internal.connection.InternalStreamConnection.openAsync
stream.openAsync is not error handled properly and when this blows up there is no callback. This is causing unexpected error on our side which cannot be handled. The error usually is I have attached a stack trace I could provide. |
| Comments |
| Comment by Yann Simon [ 13/Jan/21 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
It'd be very kind if you could release the 3.12.8 version. Thanks in advance. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Yann Simon [ 17/Dec/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
For circuit breaker, I have the idea of continuously checking the state of the mongo servers (for example by fetching the availability of concurrency tickets) and opening the circuit breaker if the server is having issues. I just don't know if fetching the metrics of the server would put too much pressure on it. Something to check at some point... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Yann Simon [ 17/Dec/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks a lot for the pointer to https://jira.mongodb.org/browse/JAVA-3909. This would be very helpful! We are using mongo 4.0.21 and are planing to update. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 14/Dec/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
FYI we've scheduled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 12/Dec/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Let me know if you need ideas on how to replace each of those in your application with something equivalent. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Yann Simon [ 11/Dec/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@jeff.yemin, a migration to the 4.x driver is something quite challenging for us. We are actually looking at it. These are the deprecations that we are using right now:
If you want more info, I'd be glad to bring it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 03/Dec/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Backported to the 3.12.x branch. Is anything in particular preventing you from upgrading to the 4.x driver? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 03/Dec/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {'name': 'jyemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}Message: Ensure DNS errors bubble up as errors in reactive streams Currently DNS lookups happen synchronously in the reactive streams
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Yann Simon [ 03/Dec/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I see that the fix made to the 4.2.0 version. As initially reported, we are using the version 3.12.7. We would also need a 3.x release to be able to use the fix. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 27/Nov/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {'name': 'jyemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}Message: Ensure DNS errors bubble up as errors in reactive streams Currently DNS lookups happen synchronously in the reactive streams
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 07/Oct/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
yann.simon.fr@gmail.com that's great to know about. Thanks for pointing it out. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Yann Simon [ 07/Oct/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
For info, a possible extension would be to use Netty for asynchronous DNS resolution: https://netty.io/4.1/api/io/netty/resolver/dns/package-summary.html I don't know how easy it would be. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sahil Anand [ 07/Oct/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
We can have a look how can we handle this at our end, until then. Thank you | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 07/Oct/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Yes, I see it now. All the DNS lookups are synchronous, which is unfortunate for async, but as a result also need to be protected. In the meantime, can you work around this by fixing your DNS configuration? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Yann Simon [ 07/Oct/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi, colleague from Sahil here.
In the version 3.12.7, we can still see the following code:
Whenever an exception occurs in stream.openAsync, the callback is never called. Ex of such an issue:
I think the simplest fix is to include stream.openAsync into the existing try. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sahil Anand [ 07/Oct/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Jeffery, I uploaded the stacktrac but I can copy it here again.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 07/Oct/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks for reporting the issue. I thought it might be a duplicate of You mentioned an attached stack trace, but I don't see one. Can you provide anything more? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sahil Anand [ 07/Oct/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Sorry for the wrong version, what we are using is the driver version is 3.12.7. |