Re: ThreadAbortException fails to get thrown from thread making remoting call.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Howard Swope wrote:
Thanks for your response...

The way that I have gotten around this is just making the calls from an AsyncDelegate and waiting for the return. This way the call is going out on a threadpool thread and the thread that I want to abort is waiting for it to return and it will throw the ThreadAbortException (I do cleanup in my finally block).
....

Haven't tried that method, just make sure you don't starve the thread pool. There could be some limit on number of threads allocated to thread pool.

The problem I run into with remoting is that in case of connection physically going down, remote call would hang forever in same cases (timing issue, waiting for response from remote host). That call is blocked in native windows api (recv on socket) and there is no way of stopping it. Eventually I guess TCP keepalive timer would kick in and tear down connection, but I've never waited that long to check. Anyway, it's rare condition, so few "hanging" threads don't impact much.

Why do you have to abort?

Regards,
Goran
.



Relevant Pages

  • Re: How to detach from remote command?
    ... Using ssh & the above program I can remotely start a background process ... without waiting for it to terminate on the remote host. ...
    (comp.os.linux)
  • Re: Interrupting a socket operation from another thread
    ... wants to stop waiting for the socket operation to complete. ... No he want's to "abort" you get this right. ... in fact that's what 'shutdown' is for. ...
    (comp.programming.threads)
  • Re: Aborting an STA thread doesnt work
    ... and I only abort if the thread is waiting for the queue. ... > If the thread is executing unmanaged code then the abort wont be ... > to the thread until it returns to managed code. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: ppp and nokia 6630
    ... waiting for anything, and then sending ATZ. ... your modem is in an indeterminate state. ... to have to achieve sync with the modem's command interface. ... ABORT 'NO CARRIER' ...
    (comp.protocols.ppp)
  • Re: Any way to abort a thread?
    ... In the full framework I can call .Abort on it, ... However, Abort does not exist in the CF, and I can't find ... This will isolate the annoying thread-handling stuff in the library, ... waiting for some app-specific event much more complicated. ...
    (microsoft.public.dotnet.framework.compactframework)