0

From time to time we are getting a Win32Exception: The wait operation timed out from somewhere inside our application. The big issue we are facing is that these exceptions contain no stacktrace, so we have no idea where they are coming from. We suspect that it might be related to EntityFramework and some heavy query, but with no stacktrace, there is no way to know which one it is.

Trying to catch the exception first-chance sadly does not help either. The exception is first caught inside our unhandled exception handler.

Has anyone ever encountered an exception like this? How do you debug it without knowing where it is coming from?

Mats
  • 45
  • 4
  • I've seen it occur (back in the day XD ) when running long SQL queries or issues with a (physical) network connection... To start with the easiest - do you have suspicious extreme long queries somewhere? – Stefan May 17 '21 at 07:54
  • Probably, but since we use EF, it never really easy to see how heavy/long they might become. It also happens rather randomly, so cannot really pinpoint it to one action/query. – Mats May 17 '21 at 08:27
  • *"Probably, but since we use EF, it never really easy to see how heavy/long they might become"* --- EF has some logfeatures which allows for tracing. This might be hard due to the possible error. If you're using mssql you could enable the profiler - or even check the windows event log for more details. I think your focus should be on reproducing the error. So, try to run your *probable* suspicious query's against the DB ans see how it behaves. – Stefan May 17 '21 at 08:37
  • Does this answer your question? [The wait operation timed out. ASP](https://stackoverflow.com/questions/39176692/the-wait-operation-timed-out-asp) – Stefan May 17 '21 at 12:21
  • Thanks, for the link. I will wait for the next time this happens and then have a look at SQL Logs etc. Weird thing is that we do have a retry-strategy and that does not even seem to get triggered by this – Mats May 17 '21 at 12:57
  • Are you catching on the `Win32Exception` explicitly? Sometimes they are wrapped in something else... See: https://stackoverflow.com/questions/32452782/cant-catch-win32exception – Stefan May 17 '21 at 14:48
  • In the code we only catch the SqlExceptions and never explicitly the Win32Exception. First-chance I only had Win32Exception enabled, but even that did not trigger. The first place where this exception can be witnessed is in the [ThreadException](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.application.threadexception?view=net-5.0) Handler – Mats May 18 '21 at 07:50

0 Answers0