Closed itadapter closed 1 year ago
WorkContext.DoGetRequestBodyAsJsonDataMapAsync
was quickly refactored when we introduced pluggable listeners.
Most likely the async stream is read in a sync fashion and this leads to loss of data?
This is related to:
See this: https://www.strathweb.com/2019/02/be-careful-when-manually-handling-json-requests-in-asp-net-core/
20230315-161652.188, b74ed7e8-b890-4b6c-a92b-5c99c703138a, dsys-app-01, Error, WAVE, Azos.Wave.Filters.ErrorFilter, [Azos.Wave.FilterPipelineException] >>error>backend-info>realip>callflow>Portal>session>dconv>latency>cors> [Azos.Wave.MvcException] MVC handler error in work processing: [Azos.Web.HTTPStatusException] 400 - Bad Request body : [Azos.Serialization.JSON.Backends.JazonDeserializationException] Code eUnterminatedObject at Line: 1 Col: 3845 Char: 3845 {batch{Data[#0{
near 0\\\",\\\"--info-level\\\":\\\"1\\\",\\\"allow\\\":{\\\"entity\\\":\\\"*\\\"}}},\\\"Verification\\\":{\\\"EmailVerification\\\":
: Unterminated object
It is very payload-sensitive. 3947 fails, 3948 does not, then a bit more payload fails again
https://github.com/azist/azos/issues/731#issuecomment-1472391293
The problem is: Kestrel/ASP infrastructure does not work properly (sometimes) using StreamReader
in sync mode, even when AllowSyncIO=true
. It is an intermittent condition that looks like a race condition in MSFT code.
For now, we have introduced dbl buffering by reading the JSON body a whole into a string variable, then parsing it synchronously. Until #731 is implemented, the copy will be necessary as a workaround for a MSFT bug.
Need unit tests Related:
836
834
833