[CSHARP-1876] Race condition in ReceiveMessage_should_handle_out_of_order_replies test Created: 30/Dec/16  Updated: 06/Feb/17  Resolved: 06/Jan/17

Status: Closed
Project: C# Driver
Component/s: Testing
Affects Version/s: 2.0
Fix Version/s: 2.4.2

Type: Bug Priority: Minor - P4
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The ReceiveMessage_should_handle_out_of_order_replies test sometimes fails due to what looks like a race condition.

The output of the test when it fails is:

    MongoDB.Driver.Core.Connections.BinaryConnectionTests.ReceiveMessage_should_handle_out_of_order_replies(async1: False, async2: False) [FAIL]
      MongoDB.Driver.MongoConnectionException : An exception occurred while receiving a message from the server.
      ---- System.IO.EndOfStreamException : Attempted to read past the end of the stream.
      Stack Trace:
        D:\jenkins\workspace\mongo-csharp-driver-build\src\MongoDB.Driver.Core\Core\Connections\BinaryConnection.cs(329,0): at MongoDB.Driver.Core.Connections.BinaryConnection.ReceiveBuffer()
        D:\jenkins\workspace\mongo-csharp-driver-build\src\MongoDB.Driver.Core\Core\Connections\BinaryConnection.cs(365,0): at MongoDB.Driver.Core.Connections.BinaryConnection.ReceiveBuffer(Int32 responseTo, CancellationToken cancellationToken)
        D:\jenkins\workspace\mongo-csharp-driver-build\src\MongoDB.Driver.Core\Core\Connections\BinaryConnection.cs(454,0): at MongoDB.Driver.Core.Connections.BinaryConnection.ReceiveMessage(Int32 responseTo, IMessageEncoderSelector encoderSelector, MessageEncoderSettings messageEncoderSettings, CancellationToken cancellationToken)
        D:\jenkins\workspace\mongo-csharp-driver-build\tests\MongoDB.Driver.Core.Tests\Core\Connections\BinaryConnectionTests.cs(395,0): at MongoDB.Driver.Core.Connections.BinaryConnectionTests.<>c__DisplayClass17_0.<ReceiveMessage_should_handle_out_of_order_replies>b__0()
           at System.Threading.Tasks.Task`1.InnerInvoke()
           at System.Threading.Tasks.Task.Execute()
        --- End of stack trace from previous location where exception was thrown ---
           at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
        D:\jenkins\workspace\mongo-csharp-driver-build\tests\MongoDB.Driver.Core.Tests\Core\Connections\BinaryConnectionTests.cs(415,0): at MongoDB.Driver.Core.Connections.BinaryConnectionTests.ReceiveMessage_should_handle_out_of_order_replies(Boolean async1, Boolean async2)
        ----- Inner Stack Trace -----
        D:\jenkins\workspace\mongo-csharp-driver-build\src\MongoDB.Driver.Core\Core\Misc\StreamExtensionMethods.cs(39,0): at MongoDB.Driver.Core.Misc.StreamExtensionMethods.ReadBytes(Stream stream, Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
        D:\jenkins\workspace\mongo-csharp-driver-build\src\MongoDB.Driver.Core\Core\Connections\BinaryConnection.cs(315,0): at MongoDB.Driver.Core.Connections.BinaryConnection.ReceiveBuffer()



 Comments   
Comment by Githook User [ 06/Jan/17 ]

Author:

{u'username': u'rstam', u'name': u'rstam', u'email': u'robert@robertstam.org'}

Message: CSHARP-1876: Throw TimeoutException from BlockingMemoryStream is _spinWaitTimeout expires.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/bc6b2d8651568317cbd9434c3b20945e8973045c

Comment by Githook User [ 06/Jan/17 ]

Author:

{u'username': u'rstam', u'name': u'rstam', u'email': u'robert@robertstam.org'}

Message: CSHARP-1876: Fix race conditions in ReceiveMessage_should_handle_out_of_order_replies.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/45d5fdbec6a8131ab40d7a5cad8f68a8899c8d92

Generated at Wed Feb 07 21:40:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.