4

We have one problem in a Production environment but we don’t see any issues in the local DEV environments.

Problem: I have one API - /api/GenerateAutoPdf/{Guid} (POST) Based on the response from this request we are opening a modal in the UI (Client). So if the response is 200 for the above POST request then the "Print modal" will open in the UI so that the user can select the generated PDF and then can print those generated PDF's from the modal.

If the response is 500 then the print modal will not open up, as there was a Internal server error.

In one scenario, even though the server responded with 500, the PDF's were generated but the "Print Modal" didn't show up as this was not a "200" OK response. The print modal didn't come up. This issue is really intermittent.

Question: While debugging the problem for finding the root cause for 500 error.

In the Event Viewer, I could see "OperationCanceledException" for this particular API request. enter image description here

enter image description here

I went through some articles on finding the root cause for the "OperationCanceledException"

From most of them, the generic point was it might be due to client closing the browser window where the browser sends the cancellation token. But this is not the case and I am not able to reproduce the issue.

Additionally, there was a lot of "OperationCanceledExceptions" in the Event Viewer logs for different API's but for those, we are not really blocked. And this also tells that the user is not closing the browser window and also this is not happening for only some users where there could be browser issues with some users.

Does anyone have any inputs to resolve this or can you guys let me know the path forward for this issue or any tips for debugging this issue?

Does this issue occur when there are packet drops in the network?

Note: This is a server issue and client technology stack which we are using should not matter.

Varun
  • 597
  • 7
  • 26
  • 2
    That's very likely a timeout – Kevin Gosse Mar 16 '19 at 12:17
  • Ok. How can I prove it has happened only because of timeout. Can you point me to any area to check in the application so that I could confirm that it is because of a timeout – Varun Mar 16 '19 at 12:25
  • And also I have verified the IIS logs and this request was served in 24 seconds which is almost equivalent to the same request which had 200 response code – Varun Mar 16 '19 at 12:59
  • There are some good tips in [this thread](https://stackoverflow.com/questions/22157596/asp-net-web-api-operationcanceledexception-when-browser-cancels-the-request). It does seem to occur because the client cancels the request. – Jesse de Wit Mar 25 '19 at 13:02
  • 2
    Could you provide some code? How are you using threads there? Is there any kind common file you're trying to access in this code? – Oscar Acevedo Mar 26 '19 at 03:22
  • @JessedeWit : I had seen the thread that you have mentioned unfortunately it is not the case. :( – Varun Mar 27 '19 at 10:03
  • @OscarAcevedo It is happening across the application so no common code is affected. It is happening randomly on different parts of the application – Varun Mar 27 '19 at 10:05
  • You may want to post your request/response headers for when this is occurring. Maybe look up the Owin header requirements. And clear SSL state before jumping between environments if you are using the same machine, since you say it is only for some users. –  Mar 28 '19 at 16:19
  • Check if you have cancelled requests on the network tab in chrome. – Tamir Daniely Mar 29 '19 at 10:10
  • It looks to me like the API call is timing out, however, whatever component you are using to generate the PDF continues to run. This would explain why the call fails but the PDF is still generated. How long does it take on average to create a PDF? What HTTP code are you getting back from the API (if any)? – JuanR Mar 29 '19 at 17:25
  • It would be nice to see if you are locking any variables so threads are blocked and a timeout occurs. When testing locally can you start process with more than one acc at the same time? – Senad Meškin Mar 29 '19 at 20:36
  • What happens when the user reloads the page while waiting for the operation to complete? Any chance that would cancel the operation? – Bill Horvath Mar 30 '19 at 04:20
  • @TamirDaniely: No it is not the cause. – Varun Apr 03 '19 at 16:10

0 Answers0