[CSHARP-534] MongoServerInstance.AcquireConnection throws InvalidOperationException Created: 23/Jul/12 Updated: 20/Mar/14 Resolved: 12/Nov/12 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 1.5 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Aristarkh Zagorodnikov | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | exception | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Minor Change | ||||||||
| Description |
|
When server instance gets disconnected and state verification have not yet kicked in, MongoServerInstance.AcquireConnection throws InvalidOperationException("Server instance XXX is no longer connected."). While this is an internal state problem (so IOE fits the scheme), I think it should be treated as a transient connection error and instead throw a MongoConnectionException (with the same message). For us, the exception types are really important, because we've built an auto-retry mechanism around driver calls, and catching something as ambiguous as InvalidOperationException makes robust error handling hard enough. |
| Comments |
| Comment by Craig Wilson [ 12/Nov/12 ] |
|
Sounds good. Thanks... |
| Comment by Aristarkh Zagorodnikov [ 12/Nov/12 ] |
|
Since the linked issue completely encompasses this case, I think this issue can be closed as |
| Comment by Craig Wilson [ 12/Nov/12 ] |
|
We have a ticket for reviewing all the exceptions thrown by the driver and, in most cases, will be wrapping them in a MongoXXXException. I'm going to link this ticket to that one in order to make sure this one gets covered. |
| Comment by Aristarkh Zagorodnikov [ 24/Jul/12 ] |
|
System.InvalidOperationException: Server instance fs.drive.bru:27017 is no longer connected. Line numbers are from our patched 1.4 version, so take them with a grain of salt =) |
| Comment by Aristarkh Zagorodnikov [ 24/Jul/12 ] |
|
I work against the 1.4 version, but testing with master shows the same behavior. This occurs when we use the GridFS API that in it's turn uses the RequestStart wrapper to ensure that all same-file requests go to the same server. I guess that all code using RequestStart would be susceptible to this issue. |
| Comment by Craig Wilson [ 24/Jul/12 ] |
|
1) Are you working against the published 1.5 driver or have you built from master? |