-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Thread-pool will add threads until system resources are exhausted #26
Comments
Correct, that behavior was intended when ChanL was originally written; the logic was that the same will happen if you allocate memory without bounds, and exhaust the heap. The only limit in the current thread pool is a "soft limit", and that sets the number of worker threads kept alive waiting for new tasks after existing ones have finished. How do you think this should be addressed? and I'm curious to hear whether you encountered this in any production system, or simply by playing around... |
Well, I'm the author of Sento and was looking at thread-pool implementations that can replace the 'made-up' dispatchers/thread-pools in Sento that are basically just actors each operating a separate thread, which effectively in Sento is used as something like a thread-pool. It can simply be addressed by capping the maximum number of threads. |
One could also use something like: https://github.com/Frechmatz/cl-threadpool |
Thank you for the links and ideas. You probably noticed that ChanL is mostly constructed so different thread pool implementations can be used; one good improvement could be adding to the The current CLOS footprint is two classes By the way, the use case that I've been wanting to support is as follows: I run several liquidity providers, each with about a dozen tasks; I need the ability to nuke and restart individual liquidity providers, so currently I get this by separating them to different lisp images. If each had its own thread pool, I could run all within one lisp image and conserve resources. From this perspective, it is fortunate that I'm small-time, and only run a few of these, although I'd like to keep a low overhead for scaling so I can take on additional clients (most people who want to profit from liquidity providing don't have or want the technical ability to deal with some tangled old lisp code). |
I'm considering whether the test suite should deliberately fail on lighter systems, by triggering this; and if so, how should the human be warned before the expected crash, in case someone who does not read documentation simply fires up slime, quicklisp, and |
Enhancement begun! Commit 180c290 prefixes |
I've added a survivable forkbomb to the test suite; values above seven will make dual-core machines uncomfortable for several minutes, unless you have more patience than the typical netizen. This will enable testing the failure mode of a hard-limited thread pool exceeding the upper limit, before the operating system becomes unresponsive. |
@mdbergmann suggested:
Definitely not; one of the hard requirements of ChanL was that the only allowed dependencies are portability layers like Bordeaux-Threads or Trivial-Garbage. The original thread pool code was taken from Eager-Future, and the complexity of that library is already out of scope for dependencies. I'm not against the inclusion of up to one utility library, however I am aware that consensus will never be achieved and it is not worth arguing about anyway. |
Incorrectly closed by excessive GitHub automation. |
Seems like the thread-pool implementation is not capping the number of maximum threads.
So submitting work in a loop, large loop, to be processed concurrently will basically kill the application because no more threads can be created.
The text was updated successfully, but these errors were encountered: