The WriteAsync method cannot be called when another write operation is pending.
See original GitHub issueHello,
We started dropping bedrock into our server application and have been getting this:
[20:53:31 ERR] AuthWorker Error processing queue System.AggregateException: One or more errors occurred. ( The WriteAsync method cannot be called when another write operation is pending.) ---> System.NotSupportedException: The WriteAsync method cannot be called when another write operation is pending. at System.Net.Security.SslStream.WriteAsyncInternal[TWriteAdapter](TWriteAdapter writeAdapter, ReadOnlyMemory1 buffer) at System.IO.Pipelines.StreamPipeWriter.FlushAsyncInternal(CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait() at ArchonPolicyServer.Server.Connections.BedrockConnection.SendAsync(Byte[] msg)
Is there anything we may be doing wrong that may allow us to work around this issue?
We’re using https://github.com/redhat-developer/kestrel-linux-transport along with it as the server runs on .NET Core 3 in linux.
Appreciate any insights you may have.
Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (6 by maintainers)
Top GitHub Comments
We suspect it’s within SslStream. We tried doing
.WriteAsync().Wait()
with a lock around it just to see if it was something in our own code, and observed no change in behavior (besides everything slowing greatly of course). The test client I’m using to produce this behavior also works in a half-duplex fashion, never sending a message before receiving a response to the previous message, and our server is sending msgpack structures all in a single write call. Theoretically this should mean that even unsafe code on the server should never trigger an unsafe write, but here we are.I’ll find some time today or tomorrow to get a minimal reproducer working.
@fuhry That’s the direction I’d like to go with it. Create an ecosystem of reader and writers that can be used to compose higher level protocols or build your own parsers.