-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
NewtonsoftJsonOutputFormatter fails on sync flushes #8302
Comments
Thanks, would it be helpful to share my startup.cs? |
In the AsyncIO PR I added temporary overrides for XML and razor, but Json didn't get one for some reason. The tests passed without it, likely because they never wrote large enough data to fill the buffer and trigger a sync flush. @GusBeare how large is the object you're serializing? Does this repro with small responses? Workarounds are already outlined in #7644. |
Not huge, about 600 rows. |
Not small. Those buffers are only KB. Go ahead and apply the workaround. We'll get this fixed for the next preview. @mkArtakMSFT |
Many thanks. I'll try the workarounds tomorrow: getting late here. Had enough. |
Though it would be helpful if you could point me in the right direction as to how to do this globally. "Each server has a AllowSynchronousIO option that controls this behavior and the default for all of them is now false." I can't find anything on how to set it for IIS in process. I am still baffled as to why it's failing though because these are async requests from angularjs. |
The JSON serializer is synchronously writing to the response body. For IIS In-proc it should be something like this.
|
I have this same issue using Kestrel .net core 3. Even with the following code implemented:
Is there a Kestrel part to this workaround? I am not using IIS, just Kestrel. |
Our solution was to replace GetJsonAsync with straight GetAsync and deserialise the stringcontent for the time being while the issue is sorted out - this has no issues with the record load. |
@aford22 what was the line before that? The complete sample for Kestrel should be:
|
Bingo, @Tratcher ! That worked perfectly. Thank you. |
I know this is closed, but I just discovered why I was suffering from this issue on very small requests (100 bytes). I had a circular reference between a two classes in EF Core, which began generating a larger response and triggering this issue. Although setting AllowSynchronousIO = true in the method, for me, did not resolve the issue. |
I still have this error in preview 5, I'm not sure how it got here. The above mentioned workaround worked for me though. |
@kevinsnijder this PR was only a temporary fix. #6397 replaced it and was part of preview5. If you're having a similar problem with preview5 please open a new issue and tell @pranavkm. |
@Tratcher I looked at some of the referenced issues and I was unable to determine if Json.net will still throw if I turn this on in preview 8. I'm assuming so as it does sync operations (unless there was a pr that I'm not seeing). |
@pranavkm were you able to determine if this is still an issue? |
@niemyjski could you please file a separate issue with a clear description of what you're seeing? |
#7644 (comment)
The text was updated successfully, but these errors were encountered: