Ticket #5174 (closed bug: duplicate)
Running out of OS threads in a server
|Reported by:||bos||Owned by:|
|Type of failure:||Runtime crash||Difficulty:|
|Test Case:||Blocked By:|
I have a web server that uses my mysql-simple package, and it dies after serving several hundred requests.
The mysql-simple package is a wrapper around the MySQL C API, which is unfortunately not signal-safe. GHC RTS signals kill it, so I've been using runInBoundThread to manage the signals from the Haskell world.
Unfortunately, the number of OS threads in flight increases with every use of runInBoundThread, so after a few hundred requests, I run out of OS threads (the default limit being 1024 threads on Linux), and my process is killed.