(not against your idea, just curious how you handle it)
(not against your idea, just curious how you handle it)
That said, I do this as well, even the best behaved daemon can get... funky... after a few months. Planned outages for a daemon restart are ok in my experience, particularly if you can fail over to other nodes as part of a rolling restart.
Of course, this refers to planned restarts, though forking servers helps with unplanned exceptions as well.
Look at something like ZeroMQ that is being rewritten specifically to avoid the non-determinism inherent in throwing an exception.
Once you're using threads it's pretty much anyone's guess as to what state the system is in at any point, add exceptions and it just gets worse.
I agree that unstructured use of threading primitives leaves you with an unpredictable system, but it's possible to build safer, higher-level abstractions and use those.
The key is to segment your system so processing is orthogonal to the implementation details of the networking protocol on a given system. Just because on a particular OS when a process closes the TCP/IP connections are dropped does not mean that every time your process crashes that client connections are dropped.
In the case of a webserver you can use something like mongrel2 / nginx that maps physical connections to backend processes so that a process restart doesn't mean a dropped connection, or failed request.
Forcing your machines to reboot early and often makes you think about and deal with these problems rather than simply delaying them until one of your nodes dies and takes out a bunch of client connections anyway.