Skip to content

Commit 377bfc3

Browse files
Similar fix for sync codepath. Motivated by [xUnit.net 00:00:28.36] PubSub.PubSubGetAllCorrectOrder_OnMessage_Sync [FAIL]
Failed PubSub.PubSubGetAllCorrectOrder_OnMessage_Sync [20 s] Error Message: System.AggregateException : One or more errors occurred. (Items: 632) (There were 1 private and 0 ambient exceptions; expected 0.) ---- System.TimeoutException : Items: 632 ---- StackExchange.Redis.Tests.SkipTestException : There were 1 private and 0 ambient exceptions; expected 0. Stack Trace: ----- Inner Stack Trace StackExchange#1 (System.TimeoutException) ----- at StackExchange.Redis.Tests.PubSub.PubSubGetAllCorrectOrder_OnMessage_Sync() in C:\repo\StackExchange.Redis\tests\StackExchange.Redis.Tests\PubSub.cs:line 452 --- End of stack trace from previous location where exception was thrown --- ----- Inner Stack Trace StackExchange#2 (StackExchange.Redis.Tests.SkipTestException) ----- at StackExchange.Redis.Tests.Skip.Inconclusive(String message) in C:\repo\StackExchange.Redis\tests\StackExchange.Redis.Tests\Helpers\Skip.cs:line 8 at StackExchange.Redis.Tests.TestBase.Teardown() in C:\repo\StackExchange.Redis\tests\StackExchange.Redis.Tests\TestBase.cs:line 190 at StackExchange.Redis.Tests.TestBase.Dispose() in C:\repo\StackExchange.Redis\tests\StackExchange.Redis.Tests\TestBase.cs:line 86 at ReflectionAbstractionExtensions.DisposeTestClass(ITest test, Object testClass, IMessageBus messageBus, ExecutionTimer timer, CancellationTokenSource cancellationTokenSource) in C:\Dev\xunit\xunit\src\xunit.execution\Extensions\ReflectionAbstractionExtensions.cs:line 79 Standard Output Messages: Running under .NET Core 3.1.12 (3.1.12) Running on: Microsoft Windows 10.0.19043 05:59:50.998: 05:59:50.998: Connect took: 2ms 05:59:51.000: Published: 99 05:59:51.000: Published: 199 05:59:51.001: Published: 299 05:59:51.001: Published: 399 05:59:51.001: Received: 99 05:59:51.002: Published: 499 05:59:51.002: Received: 199 05:59:51.002: Published: 599 05:59:51.002: Received: 299 05:59:51.002: Published: 699 05:59:51.003: Received: 399 05:59:51.003: Published: 799 05:59:51.003: Received: 499 05:59:51.003: Published: 899 05:59:51.003: Received: 599 05:59:51.003: Published: 999 05:59:51.004: Send loop complete. 06:00:11.015: 06:00:11.015: Service Counts: (Scheduler) Queue: 41597, Pool: 0 06:00:11.015: 05:59:51.004: Connection failed (SocketFailure): 127.0.0.1:6379/Subscription: StackExchange.Redis.RedisConnectionException: SocketFailure (ReadSocketError/ConnectionReset, last-recv: 5890) on 127.0.0.1:6379/Subscription, Idle/Faulted, last: SUBSCRIBE, origin: ReadFromPipe, outstanding: 0, last-read: 0s ago, last-write: 0s ago, keep-alive: 3s, state: ConnectedEstablished, mgr: 9 of 10 available, in: 0, in-pipe: 0, out-pipe: 0, last-heartbeat: never, last-mbeat: 0s ago, global: 0s ago, v: 2.2.23.28554 ---> Pipelines.Sockets.Unofficial.ConnectionResetException: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host. at Pipelines.Sockets.Unofficial.Internal.Throw.Socket(Int32 errorCode) in /_/src/Pipelines.Sockets.Unofficial/Internal/Throw.cs:line 59 at Pipelines.Sockets.Unofficial.SocketAwaitableEventArgs.GetResult() in /_/src/Pipelines.Sockets.Unofficial/SocketAwaitableEventArgs.cs:line 74 at Pipelines.Sockets.Unofficial.SocketConnection.DoReceiveAsync() in /_/src/Pipelines.Sockets.Unofficial/SocketConnection.Receive.cs:line 64 --- End of inner exception stack trace --- at System.IO.Pipelines.PipeCompletion.ThrowLatchedException() at System.IO.Pipelines.Pipe.GetReadResult(ReadResult& result) at System.IO.Pipelines.Pipe.GetReadAsyncResult() at System.IO.Pipelines.Pipe.DefaultPipeReader.GetResult(Int16 token) at StackExchange.Redis.PhysicalConnection.ReadFromPipe() --- End of inner exception stack trace ---
1 parent 8a6f3cb commit 377bfc3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/StackExchange.Redis/PhysicalBridge.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,11 @@ private WriteResult QueueOrFailMessage(Message message)
136136
// you can go in the queue, but we won't be starting
137137
// a worker, because the handshake has not completed
138138
message.SetEnqueued(null);
139-
message.SetBacklogState(_backlog.Count, null);
140-
_backlog.Enqueue(message);
139+
lock (_backlog)
140+
{
141+
message.SetBacklogState(_backlog.Count, null);
142+
_backlog.Enqueue(message);
143+
}
141144
return WriteResult.Success; // we'll take it...
142145
}
143146
else

0 commit comments

Comments
 (0)