Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 14th, 2007, 09:22 AM
Registered User
 
Join Date: Aug 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Remoting aborts thread after 2 minutes

(This is a C# problem experienced in an ASP.Net application. This post was first sent to the ASP.Net forum, but with no answer. I'm not usually a cross poster, but maybe this fits better in this forum? Hope someone can help...)

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?
 
Old August 14th, 2007, 12:15 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I have only played with remoting and threading a little so I can't offer much advice. Unfortunately, I haven't found many participants on this forum who have this kind of experience.

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
convert time to minutes stolte XSLT 3 November 21st, 2008 04:12 AM
how to set the maximum minutes in setTimeout() or kasipandian Javascript 2 February 18th, 2008 12:37 PM
Calculate time (minutes) between two times rtr1900 Classic ASP Basics 18 January 2nd, 2008 03:06 PM
Remoting timing out after 2 minutes BrainWave ASP.NET 2.0 Professional 0 August 13th, 2007 06:54 AM
Thread-safety techniques for secure .mnet remoting vipulss C# 0 October 10th, 2006 08:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.