Comments (10)
@xuzhg this looks like the most critical issue currently tracked in the repo... is anyone actively looking into it? Could it be bumped in priority?
from aspnetcoreodata.
Another misbehavior is that when GETing the same url with the same $expand
twice at the same time, one request returns the result as expected and the other one the result but not expanded. Maybe this will not show up in the reproduction repo since there are no data in there.
from aspnetcoreodata.
This seems like it is responsible for the various issues I'm having with response compression when trying this preview:
2021-01-05 12:31:24.8339 [13] #1 ERROR Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware - An unhandled exception has occurred while executing the request.
System.InvalidOperationException: Only one asynchronous reader or writer is allowed time at one time.
at System.IO.Compression.DeflateStream.ThrowInvalidBeginCall()
at System.IO.Compression.DeflateStream.WriteAsyncMemory(ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
at System.IO.Compression.DeflateStream.WriteAsync(Byte[] array, Int32 offset, Int32 count, CancellationToken cancellationToken)
at System.IO.Compression.GZipStream.WriteAsync(Byte[] array, Int32 offset, Int32 count, CancellationToken cancellationToken)
at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionBody.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
at Microsoft.AspNetCore.OData.Formatter.StreamWrapper.Write(Byte[] buffer, Int32 offset, Int32 count)
at Microsoft.OData.MessageStreamWrapper.MessageStreamWrappingStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at System.Xml.XmlUtf8RawTextWriter.FlushBuffer()
at System.Xml.XmlUtf8RawTextWriter.Flush()
at System.Xml.XmlWellFormedWriter.Flush()
at Microsoft.OData.ODataMetadataOutputContext.WriteMetadataDocument()
at Microsoft.OData.ODataMessageWriter.<>c.<WriteMetadataDocument>b__70_0(ODataOutputContext context)
at Microsoft.OData.ODataMessageWriter.WriteToOutput(ODataPayloadKind payloadKind, Action`1 writeAction)
at Microsoft.OData.ODataMessageWriter.WriteMetadataDocument()
at Microsoft.AspNetCore.OData.Formatter.Serialization.ODataMetadataSerializer.<>c__DisplayClass1_0.<WriteObjectAsync>b__0()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__277_0(Object obj)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.OData.Formatter.ODataOutputFormatterHelper.WriteToStreamAsync(Type type, Object value, IEdmModel model, ODataVersion version, Uri baseAddress, MediaTypeHeaderValue contentType, HttpRequest request, IHeaderDictionary requestHeaders, ODataSerializerProvider serializerProvider)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeResultFilters>g__Awaited|27_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
And others:
2021-01-05 12:31:24.6169 [8] #1 ERROR Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware - An unhandled exception has occurred while executing the request.
System.InvalidOperationException: Only one asynchronous reader or writer is allowed time at one time.
at System.IO.Compression.DeflateStream.ThrowInvalidBeginCall()
at System.IO.Compression.DeflateStream.WriteAsyncMemory(ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
at System.IO.Compression.DeflateStream.WriteAsync(Byte[] array, Int32 offset, Int32 count, CancellationToken cancellationToken)
at System.IO.Compression.GZipStream.WriteAsync(Byte[] array, Int32 offset, Int32 count, CancellationToken cancellationToken)
at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionBody.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
2021-01-05 12:31:24.6169 [7] #1 ERROR Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware - An unhandled exception has occurred while executing the request.
System.InvalidOperationException: Only one asynchronous reader or writer is allowed time at one time.
at System.IO.Compression.DeflateStream.ThrowInvalidBeginCall()
at System.IO.Compression.DeflateStream.WriteAsyncMemory(ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
at System.IO.Compression.DeflateStream.WriteAsync(Byte[] array, Int32 offset, Int32 count, CancellationToken cancellationToken)
at System.IO.Compression.GZipStream.WriteAsync(Byte[] array, Int32 offset, Int32 count, CancellationToken cancellationToken)
at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionBody.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
2021-01-05 12:31:24.6169 [10] #1 ERROR Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware - An unhandled exception has occurred while executing the request.
System.InvalidOperationException: Only one asynchronous reader or writer is allowed time at one time.
at System.IO.Compression.DeflateStream.ThrowInvalidBeginCall()
at System.IO.Compression.DeflateStream.WriteAsyncMemory(ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
at System.IO.Compression.DeflateStream.WriteAsync(Byte[] array, Int32 offset, Int32 count, CancellationToken cancellationToken)
at System.IO.Compression.GZipStream.WriteAsync(Byte[] array, Int32 offset, Int32 count, CancellationToken cancellationToken)
at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionBody.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
2021-01-05 12:31:24.6658 [7] #2 WARN Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware - The response has already started, the error page middleware will not be executed.
2021-01-05 12:31:24.7588 [7] #13 ERROR Microsoft.AspNetCore.Server.Kestrel - Connection id "0HM5HL0BCH230", Request id "0HM5HL0BCH230:00000002": An unhandled exception was thrown by the application.
System.InvalidOperationException: Only one asynchronous reader or writer is allowed time at one time.
at System.IO.Compression.DeflateStream.ThrowInvalidBeginCall()
at System.IO.Compression.DeflateStream.WriteAsyncMemory(ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
at System.IO.Compression.DeflateStream.WriteAsync(Byte[] array, Int32 offset, Int32 count, CancellationToken cancellationToken)
at System.IO.Compression.GZipStream.WriteAsync(Byte[] array, Int32 offset, Int32 count, CancellationToken cancellationToken)
at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionBody.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
from aspnetcoreodata.
There's a concurrency issue when using the EnableQueryAttribute since 7.5.4.
See OData/WebApi#2390
It might be the culprit here as well.
from aspnetcoreodata.
Got the same issue, when a lot of request arrive at the same time, there is a chance that some of them end up in a System.ObjectDisposedException
.
Here you got the exception as JSON with StackTrace, maybe that helps solving:
{
"ClassName": "System.ObjectDisposedException",
"Message": "Cannot write to the response body, the response has completed.",
"Data": null,
"InnerException": null,
"HelpURL": null,
"StackTraceString": "
at Microsoft.AspNetCore.Server.IIS.Core.HttpResponseStream.ValidateState(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.IIS.Core.HttpResponseStream.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.IIS.Core.WrappingStream.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
at Microsoft.AspNetCore.OData.Formatter.StreamWrapper.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
at Microsoft.OData.MessageStreamWrapper.MessageStreamWrappingStream.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
at Microsoft.OData.AsyncBufferedStream.FlushBuffersAsync(Queue`1 buffers)+MoveNext()
at Microsoft.OData.TaskUtils.<>c__DisplayClass25_0.<Iterate>b__1(Task antecedent)
",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": null,
"HResult": -2146232798,
"Source": "Microsoft.AspNetCore.Server.IIS",
"WatsonBuckets": null,
"ObjectName": "HttpResponseStream"
}
from aspnetcoreodata.
I'm facing the same issue in version 8.0.10
Does someone have news about this issue or workarounds etc?
from aspnetcoreodata.
8.0.2
During heavy load there are cases when response contains data from other responses, even if response from other table
from aspnetcoreodata.
It's critical. Please have a look with high priority.
from aspnetcoreodata.
We got same issue. Waiting for fix. Thank you.
from aspnetcoreodata.
@xuzhg Is there any chance that you can look after this issue?
I can reproduce it very easily on my machine with version 8.0.12.
To create some load I'm using these few lines: https://gist.github.com/manureini/71b0c6384b561179f68bcb28d5781b43
Everything will run without any exception.
When Adding
await Task.Delay(1000);
to WriteObjectAsync
of a custom ODataResourceSetSerializer
the exception will be thrown in the code of the gist.
The result starts like this in my case:
{"@odata.context":"http://localhost:5000/api/$metadata#Department(Person(),ApplicationShiftAssignments(Shift(Job())))"
The context contains filter values of the other request.
Maybe my tests can help a little bit.
from aspnetcoreodata.
Related Issues (20)
- Instance Annotations for properties with $select query option HOT 1
- Custom FilterBinder doesn't work on actions with querying via ODataQueryOptionParser HOT 7
- It's still not clear how to filter by enum property HOT 7
- How to define `EDM model` that add subquery on control to `OData Endpoint Mapping`? HOT 3
- How do I use the month function of date type in a group query
- WebApiAssembliesResolver class missing causing slow model build HOT 2
- Allow casting Edm.Untyped to a primitive type for `$filter`ing when the other operand is also a primitive HOT 4
- There seems to be an issue with case conversion when using Newtonsoft, I don't know yet if it's just case HOT 5
- Passing a Complex object in the ODATA function HOT 5
- Faulty link generation when creating entities with string key and slashes HOT 1
- NullReference exception generated when using FilterClause.ApplyTo method with open properties in the filter query HOT 2
- Case sensitive issue on ODatadynamic Model HOT 2
- Conflicting routes when using NSwag and OData HOT 6
- Data not loaded correctly in Excel and Power BI Desktop with the use of $expand in OData feed HOT 10
- OData DeepInsert not binding correctly HOT 3
- Strange time zone propagation in the filter HOT 2
- Select query throw an error on a dynamic property dictionary HOT 7
- OData + EfCore Filter dynamic properties HOT 2
- FEATURE REQUEST: be able to conditionally omit properties from response payloads HOT 2
- Missing property error when applying select manually HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aspnetcoreodata.