[JAVA-2631] AsynchronousSocketChannelStream open methods don't always wrap IOException in MongoSocketOpenException Created: 10/Oct/17 Updated: 29/Oct/23 Resolved: 09/Jan/18 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Connection Management |
| Affects Version/s: | 3.0.0 |
| Fix Version/s: | 3.6.2 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Farès Hassak | Assignee: | Jeffrey Yemin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Description |
|
Hello, The test below is failed : AsyncStreamTimeoutsSpecification should throw a MongoSocketOpenException when the AsynchronousSocket Stream fails to open
InternalStreamConnection.open() catch an exception of type java.io.IOException (Throwable t)
A possible solution : The IOException is throw by stream.open();
Farès |
| Comments |
| Comment by Githook User [ 09/Jan/18 ] | ||||||||||||||||
|
Author: {'name': 'Jeff Yemin', 'username': 'jyemin', 'email': 'jeff.yemin@10gen.com'}Message: | ||||||||||||||||
| Comment by Githook User [ 09/Jan/18 ] | ||||||||||||||||
|
Author: {'name': 'Jeff Yemin', 'username': 'jyemin', 'email': 'jeff.yemin@10gen.com'}Message: | ||||||||||||||||
| Comment by Jeffrey Yemin [ 08/Jan/18 ] | ||||||||||||||||
| Comment by Charles Sarrazin (Inactive) [ 08/Jan/18 ] | ||||||||||||||||
|
I also agree. The issue should be handled at a lower level than in
| ||||||||||||||||
| Comment by Jeffrey Yemin [ 08/Jan/18 ] | ||||||||||||||||
|
The solution in https://github.com/mongodb/mongo-java-driver/pull/421 is also viable, but I think the above conveys the intent a bit better by handling it a lower level. | ||||||||||||||||
| Comment by Jeffrey Yemin [ 08/Jan/18 ] | ||||||||||||||||
|
OK, I think I see the problem now, and a possible fix would be to change this line from:
to
| ||||||||||||||||
| Comment by Charles Sarrazin (Inactive) [ 08/Jan/18 ] | ||||||||||||||||
|
From what I understand, this is a low-level error from Windows-based environments. I also checked that the Java source code also seems to be using the ConnectEx behind the scenes (https://github.com/dmlloyd/openjdk/blob/342a565a2da8abd69c4ab85e285bb5f03b48b2c9/src/java.base/windows/native/libnio/ch/WindowsAsynchronousSocketChannelImpl.c), so this may actually be linked to the actual Java socket implementation on Windows. That explains the error message : "Le délai de temporisation de sémaphore a expiré.". On OSX (10.13.2 High Sierra), I also have an error, but the stack trace seems to be different:
In any case, from my perspective, I think the test expects the wrong exception, or that we incorrectly wrap the exception in some cases. | ||||||||||||||||
| Comment by Farès Hassak [ 21/Dec/17 ] | ||||||||||||||||
|
Hi, I still have the same error with the last commit of the master branch. Farès | ||||||||||||||||
| Comment by Ross Lawley [ 19/Dec/17 ] | ||||||||||||||||
|
Hi Farès Hassak, we've still been unable to replicate this, I'd be interested if this is an issue you can still replicate. Regards, Ross | ||||||||||||||||
| Comment by Farès Hassak [ 13/Oct/17 ] | ||||||||||||||||
|
I have updated java and still have same error. Build time: 2017-07-07 14:02:41 UTC Groovy: 2.4.11 mongod -version | ||||||||||||||||
| Comment by Farès Hassak [ 11/Oct/17 ] | ||||||||||||||||
|
D:\github\mongo-java-driver ( | ||||||||||||||||
| Comment by Ross Lawley [ 11/Oct/17 ] | ||||||||||||||||
|
Hi Farès Hassak, Thank you for the ticket, we're unable to replicate here. The `AsynchronousSocketChannelStream#openAsync` method is responsible for catching the `IOException` and wrapping it in a `MongoSocketOpenException`. I'm interested why that is not happening in your case? To see if we can replicate, could you let me know what version of Java you are using? Ross | ||||||||||||||||
| Comment by Farès Hassak [ 10/Oct/17 ] | ||||||||||||||||