Thread Crash Protection

  • Thread starter Thread starter quortex
  • Start date Start date
Q

quortex

Hi,

I have a server messaging system which marshals (serialises) message
objects to and from a comms system. i..e listens/sends over a udp port.

I have multiple threads that process messages in parallel. Basically
what I would like to achieve is a way of isolating these running
threads from each other so that if a thread crashes the other threads
continue to run.

Ideally I would also like to be able to detect this and restart the
worker thread that crashed so it can start picking up messages again.

Is this possible? Do I need to be looking at application domains to
solve this problem? Obviously web servers do something similar to this,
how hard is it to achieve?

Kind Regards,
Mark
 
I have a server messaging system which marshals (serialises) message
objects to and from a comms system. i..e listens/sends over a udp port.

I have multiple threads that process messages in parallel. Basically
what I would like to achieve is a way of isolating these running
threads from each other so that if a thread crashes the other threads
continue to run.

Ideally I would also like to be able to detect this and restart the
worker thread that crashed so it can start picking up messages again.

Is this possible? Do I need to be looking at application domains to
solve this problem? Obviously web servers do something similar to this,
how hard is it to achieve?

What kind of crashes are you expecting? If it's just a case of
exceptions, then you just need normal exception handling to notice that
something has gone wrong in one thread - the other threads don't need
to do anything special.
 
Hi John,

This is a very good point actually I think I have been overcomplicating
the matter. Probably thinking about it too much.

I guess all I need to do is catch any exceptions that are raised and
detect this in the host process and restart the worker thread.

The only thing I assume this will not cover is fatal errors such as
accessing invalid memory such as multithreaded locking errors etc. It
would be good if I could handle any kind of failure within the thread
and report it rather than bringing the server down.

Catching any unhandled exception though would definitely be the most
simple solution and it most suitable.

Kind Regards,
Mark
 
Back
Top