Skip to content

AllowSynchronousIO set to false causes compression exception in ASP.NET Core 2.2. #10983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kieronlanning opened this issue Feb 16, 2019 — with docs.microsoft.com · 7 comments
Labels
Pri2 Source - Docs.ms Docs Customer feedback via GitHub Issue
Milestone

Comments

Copy link

When AllowSynchronousIO is configured to false, essentially barring any blocking calls from the request pipeline, compression failed with the following exception:

System.InvalidOperationException: Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead.
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpResponseStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.Compression.DeflateStream.PurgeBuffers(Boolean disposing)
   at System.IO.Compression.DeflateStream.Dispose(Boolean disposing)
   at System.IO.Stream.Close()
   at System.IO.Compression.GZipStream.Dispose(Boolean disposing)
   at System.IO.Stream.Close()
   at Microsoft.AspNetCore.ResponseCompression.BodyWrapperStream.Dispose(Boolean disposing)
   at System.IO.Stream.Close()
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@dotnet-bot dotnet-bot added the Source - Docs.ms Docs Customer feedback via GitHub Issue label Feb 16, 2019
@guardrex
Copy link
Collaborator

Hello @kieronlanning ... This is going to be fixed with the release of 3.0 (see this remark). The error message is clear, so I'm not too worried about noting it in the 2.2 version of the topic.

@guardrex guardrex added the P4 label Feb 16, 2019
@guardrex guardrex added this to the Backlog milestone Feb 16, 2019
@kieronlanning
Copy link
Author

kieronlanning commented Feb 16, 2019

Thanks @guardrex - is this not being backported to 2.x?

I would have thought a note in the docs would be a good value add, setting AllowSynchronousIO to false is a good move. But as the middleware doesn't support it, a quick note would save people a lot of time.

@guardrex
Copy link
Collaborator

I was told that the decision on that is made a little later in the release cycle. The announcement for the AllowSynchronousIO updates seem to indicate 3.0+.

Ping them on the discussion issue for the announcement to ask about that: dotnet/aspnetcore#7644 ... and then come back and mention the answer over here.

quick not would save people a lot of time

We actively don't document every error condition. Management would like us to let the error message cover the scenario. Also note that this is the first time this has come up for this topic (AFAIK) since the topic was written.

@Tratcher
Copy link
Member

No it won't be backported. We needed new APIs like DisposeAsync to make it work right.

@guardrex
Copy link
Collaborator

@Rick-Anderson It could be seen to fall into the bucket of not documenting every error condition that an error message explains. This is the first time this has ever come up. Not sure it's worth the space/trouble, especially given that this goes away with 3.0. I suggest closing, but let me know otherwise if you would like something done.

@Rick-Anderson
Copy link
Contributor

It's unexpected behavior I think is worth pointing out. @tdykstra and @scottaddie may differ.

@danroth27 do we have a policy on this?

@danroth27
Copy link
Member

@Rick-Anderson I'm not aware of any policy on this.

The error message seems pretty clear and this is getting fixed in 3.0, so I don't see a lot of value in documenting this for 2.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pri2 Source - Docs.ms Docs Customer feedback via GitHub Issue
Projects
None yet
Development

No branches or pull requests

6 participants