Open spenceclark opened 3 years ago
OK its seems to be specific to Newtonsoft - I switched my JSON serialisation from Newtonsoft to the new System.Text.Json implementation and I no longer get those warnings.
Hmmm, System.Text.Json has too many other shortcomings for me to migrate to it for now. Having to revert to Newtonsoft and live with the potential blocking.
Would be interested to hear if anyone else has this problem.
Ah - https://github.com/JamesNK/Newtonsoft.Json/issues/1193 - Ben, it looks like you already raised the issue of async serialisation in Newtonsoft, and its never going to happen.
This appears to be where it is happening inside MVC - Its strange, I have AllowSynchronousIO turned off so the framework should actually stop if it detects sync writes to output stream.
Hi, I just found the exact same thing. Upgrading from .net core 3.1 to .net 5 seems to have fixed it(?)
Hi, I just found the exact same thing. Upgrading from .net core 3.1 to .net 5 seems to have fixed it(?)
Ah ok. Upgrade is on my roadmap soon at least. But did it fix it, or did it silently switch you from Newtonsoft to System.Text.Json?
I don't think it can switch us automatically, we're using JsonConvert.SerializeObject. It also seemed to fixed an issue on linux where we were encountering 'thread exhaustion' when lots of people hit our API.
Excuse the code, it's 10 years old: https://github.com/openchargemap/ocm-system/blob/0a7a52d85e4671b42b0b5ed52cb958be3068ed51/API/OCM.Net/OCM.API.Web/Compatibility/OutputProviders/JSONOutputProvider.cs#L20
I have a pretty standard dotnet Web API which returns JSON. All standard framework stuff.
I am getting this in my logs everytime the size of the response goes above a certain level. For example I can call an API with parameters that causes it to return a few records and I don't get the message. But then the same API with parameters that cause it to return 50 records I get the warning - in fact this same warning is reported hundreds of times at once.
As the stack trace seems to be entirely inside the MVC framework code, it doesn't seem like I can do anything about it.
Has anyone else seen this? As it stands it is creating too much noise in the log to be able to identify real problems.