I was using threads in my original version of the script, but ran into several issues:
- Starting new threads seemed to be much heavier in resource usage than starting new forks (and I'm forking on demand several times within a main event loop)
- Worker threads were getting seemingly random SIGALRM signals, which ended up bombing out the entire process with an "Alarm Clock" message
- I couldn't find a definitive answer on whether many of the modules I'm using are threadsafe.
- Quite frankly, I understand forking much better on a conceptual level than ithreads
So I ended up rewriting it with forks and it seems much more stable this way.