[CSHARP-791] Race condition with reusing connections Created: 07/Aug/13 Updated: 25/Aug/15 Resolved: 30/Aug/13 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 1.8.1 |
| Fix Version/s: | 1.8.3 |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | John Lyon-Smith | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
OSX, Mono 3.2.1 |
||
| Attachments: |
|
||||
| Issue Links: |
|
||||
| Backwards Compatibility: | Fully Compatible | ||||
| Description |
|
When executing the code: List<TDmo> items = cursor.ToList(); An error occurs deserializing a document. Code in the finally block of MongoDB.Bson/Serialization/Serializers/BsonClassMapSerializer.cs, DeserializeMemberValue(BsonReader, BsonMemberMap) throws a nice exception. Then, while unwinding the stack the finally block in MongoCSharp/MongoDB.Driver/Operations/QueryOperation.cs, Execute(IConnectionProvider) calls KillCursor() which calls AcquireConnection(). This appears to acquire the connection that is in the process of being closed from the exception above. If you step through the code in the debugger (MonoDevelop or Xamarin Studio), you slow things down enough so that a FileFormatException is throw. In production, you typically just the InvalidOperationException. |
| Comments |
| Comment by Githook User [ 25/Aug/15 ] |
|
Author: {u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by Githook User [ 25/Aug/15 ] |
|
Author: {u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by auto [ 25/Sep/13 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by auto [ 25/Sep/13 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by auto [ 29/Aug/13 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by auto [ 29/Aug/13 ] |
|
Author: {u'username': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}Message: |
| Comment by John Lyon-Smith [ 25/Aug/13 ] |
|
Sample that repros the bug under Mono 3.0. |
| Comment by John Lyon-Smith [ 25/Aug/13 ] |
|
I'm attaching a sample program that reproduces the problem. Here is the stack trace I get from running in Xamarin Studio: System.InvalidOperationException: Server instance localhost:27017 is no longer connected. If you change numDocs to 1 you get the expected exception: System.IO.FileFormatException: An error occurred while deserializing the Items property of class CSHARP791.Test: An error occurred while deserializing the B property of class CSHARP791.Item: Input string was not in the correct format ---> System.IO.FileFormatException: An error occurred while deserializing the B property of class CSHARP791.Item: Input string was not in the correct format ---> System.FormatException: Input string was not in the correct format |
| Comment by Craig Wilson [ 08/Aug/13 ] |
|
Thanks for reporting. Could you provide the stack traces so we can attempt to reproduce? If you have a small program demonstrating the problem, that would help even more. |