Our application crashes from time to time due to this error: i do not want to decode this error myself, But there are some questions about this one possible reason:
I see the code in system.web with ILSP and I have come to the conception that the http loses the runtime context (and an unmanaged Indicator) and therefore crash I have no details about the exception, so I All the codes are examined and everything is very straightforward except for an API call.
This looks like (or pseudo-code):
private async Task SearchSync () {Fx < Stream, http content, transportcontext, task & gt; Search = async (stream, content, transportContext) = & gt; {StreamWriter Writer = New Streamer (Stream); & Lt; Data & gt; Write = new action & lt; Data & gt; () {Author. Author; Data ;; Writer.WriteLine (); Writer.flush (); }; & Lt; Tasks & gt; Task = new list & amp ;; Tasks & gt; (); (Task) service (service in service) {taskss.Add (task.ron ((=) → service.Calla SINC ());} Wait for the Task When someone (Task Daley (10000), Task .jain (all);}; Response.Content = new PushStreamContent (search, "text / event-stream");}
It seems a bit weird but the reason for this is: / P>
- We need to trigger some services, half of them do not have any async client libraries. We have some process before and after the service call Also, like making a DB call (not ASCNC, thanks to the Mongo driver) and making CPU-intensive calculations.
- It may take a very long time to answer each service (like 1 minute ). So, as soon as possible, try pushing the content into the same reaction stream.
- We do not want to wait for the user for such a long time, so we request the user Cancel, but the search will continue, so the data is available the next time.
So the question is: What can be lost http context of some kind of code? In the following by means of lost: In the linked question you see that an original methode system fails inside. Web. Probably because this method has passed IntPtr (Coming from http reference) is no longer valid
Are there any potential problems I do not see? How to deal with parallel works in IIS?
Edit: Why is the service. CallAsync Async?
The code simplifies the real situation. In my code the service is a cover around a real service. Each service has several stages, many classes and many levels of mediators, but the structure is like this:
GetFromDatabase (); // is not asaccessive yet, because the Mongo driver awaits CallServiceAsync (); // Sometimes async, sometimes not, depending on the service. PrepareResults (); // async no, but CPU intensive
So in my view, it makes sense, to parse it to reduce the reaction time.
HttpContext is stored on synchronization conttsbox. Withdrawing Threadball Thread With Work You are not using SC and so you do not have access to HTTPNTTEX.
If callax
is an async method that you do not really need to use the task. Run here and you can store the work instead of:
tasks.Add (service.CallAsync);
If you still need work, run you can pass HTTP to Manually :
var reference = HttpContext.Current; tasks.Add (task.run ((=) {HttpContext.Current = reference; service.CallAsync (write)})
No comments:
Post a Comment