Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Random Session Timeout in ASP.NET MVC3

i have an application which gets random session timeouts. (IIS 7.5 on Windows 2008 R2, .NET 4.0)

i tried the following:

  • checked the application log if the w3wp.exe process was crashed, but there is no entry.
  • disabled in the application pool the rapid fail protection
  • moved to the sql server state provider to be sure the loadbalancers sticky session is not the problem. (we use a kemp loadmaster).
  • ensured that no other applications use the same application pool.
  • checked that exceptions in a thread of a called assembly is correctly handled. (simulated using throw new exception) and the error handling was correct.
  • ensured that the validationKey and decryptionKey is set in the webconfig on all 4 webservers to the same key.

i run now out of ideas how to spot this evil bug. any suggestions? i cannot reproduce the problem on my local machine in the debugger.

one point which is maybe important, the move from page 1 to page 2 where the session loss often happens, takes sometimes more than 120 seconds, because of a third party system which is connected via tcp socket.

like image 505
NickD Avatar asked May 25 '11 11:05

NickD


2 Answers

HI Snoopy you linked to my question as they are similar,

As my appool was crashing I tried this solution. If your appool crash's this may help http://support.microsoft.com/kb/911816

the solution stop fix hack kept my app-pool up but didn't fix the problem,

<configuration>
<runtime>
    <legacyUnhandledExceptionPolicy enabled="true" />
</runtime>

If your app-pool is still intact you might try ELMAH as this helped me a lot http://code.google.com/p/elmah/

you can use this code to get ELMAH to handle unmanaged exceptions http://code.google.com/p/elmah/issues/detail?id=199

I am curious if it is MVC 3.0 problem with .net 4.0 as i have several very similar apps running using MVC 2.0 with no problems, Only started when I moved to MVC 3.0

like image 73
rqmedes Avatar answered Oct 18 '22 02:10

rqmedes


Does it happen on a single server? Sure sounds like an issue with the web-farm.

Can you alter your app so you don't use the 3rd-party app for testing?

You have to eliminate pieces until the failure goes away, then add stuff back. Restore 3rd party app, turn other servers back on, etc.

like image 36
n8wrl Avatar answered Oct 18 '22 03:10

n8wrl