Hi!
I have an ASP.Net solution which uses remoting to allow for hotswappable plugins. Everything runs on the same computer - the MarshalByRefObject objects are simply loaded in a new AppDomain and when new plugin-dlls are available, the old AppDomain is unloaded, and the new plugins are loaded into a new AppDomain.
The problem is when the call to the plugin takes a long time - more than two minutes to be precise. Then the thread in which the plugin runs is aborted: I get a ThreadAbortException with the text "Thread was being aborted".
The stack trace doesn't seem relevant, as this happens at random places in the code, depending upon where the program is when the thread is aborted.
I've tried extending the lease for the object and the IIS timeout (in web.config) with no improvement. I've tried catching the ThreadAbortException and using ResetAbort() like so:
Code:
try
{
SomeCall();
SomeOtherCall();
}
catch (ThreadAbortException)
{
Thread.ResetAbort();
SomeCall();
SomeOtherCall();
}
YetAnotherCall();
If the thread is aborted in the first SomeCall(), then the abort is reset and SomeCall() and SomeOtherCall() is called as expected in the catch clause. But when it then comes to YetAnotherCall(), a new ThreadAbortException is thrown.
Another thing - the Thread doesn't throw the Exception at exactly 2 minutes after the method was called - if the two minute mark happens in the middle of a time consuming call, it does finish and then the thread is exception comes when the next line is executed. But when it is thrown, I can see from the logs that the two minute mark always happens during the last call to return OK.
Does anyone know what is going on here?