Hi Ethan,
Anyway, There should be only a single thread running at the time the error
has been thrown. The Web Service creates exactly two threads and then
calls
the following
if ((!NTThread.Join(TimeOut)|| !RefSeqThread.Join(TimeOut)))
{
//Code to deal with time outs
}
The ThreadAbortException is being called after this point in the code.
I do not ever call thread.abort.
I do not create any more threads.
I think that means that both of those threads should be synchronized.
Right?
No. Synchronization means that shared state can be accessed safely by
multiple threads, usually with locks, or that their execution is
synchronized so that they can run in a controlled, serial manner, usually
with wait handles.
It's possible that the threads are synchronized, but it's not implicit just
by calling Join. All that does is block the calling thread until the joined
thread ends. Afterwards, your code does the same for another thread. In
the meantime, the threads could be messing up all sorts of shared state if
they aren't properly synchronized.
Could one somehow be sneaking past this point without me realizing? Any
other
ideas?
If you're specifying a time out value that elapses before one of the threads
ends, then yes. In your "code to deal with time outs", are you ending the
threads somehow or does the executing thread just continue on about its
business? I'm curious to knows what code goes there.
I may just patch it with a "Thread.ResetAbort", but I would prefer to get
to
the root of the issue if I can.
Roman's suggestion may be correct, as Willy pointed out, but to solve the
problem you're either going to have to use Thread.ResetAbort or increase the
timeout period for the request.
Is the client receiving the ThreadAbortException or some timeout exception?
I believe that a timeout indicates that your error may be related to the
AppDomain being unloaded, as was suggested by Willy, since the web service
won't wait for the abort exception; otherwise, I would assume that it's your
code causing the abort and not the service timing out since the service
would be expecting a response and instead receive the abort exception.
--
Dave Sexton
http://davesexton.com/blog