-
-
Notifications
You must be signed in to change notification settings - Fork 232
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
gproc_pool:claim doesn't return worker when calling process is killed #109
Comments
It's true that the code doesn't handle the case of a process inside a claim operation gets killed from the outside. Strictly speaking, this is a bug. Fixing it will cause a general slowdown, but I think I found a way that is still cheap enough. See PR #110. |
Looks good and simple, can't find disadvantages |
Describing it to my son, I came up with some failure scenarios that seem very hard to address. Basically, the approach is inherently vulnerable to the calling process being murdered while running inside the claim. Starting from the (correct) assumption that the process could be killed after any given call, at least the following scenarios, however unlikely, come to mind:
Considering the above, one could either conclude that the Alternatively, figure out a different approach that's safe and not so much slower that the function becomes unfit for its purpose. |
(This would be a good time to play around with QuickCheck/Pulse ...) |
Since it certainly is an improvement over the previous implementation, I decided to merge. We can try to eliminate the (very slight) holes in the algorithm later. |
May be it's better in place of kill + reset_counter send a message to spawned process.
|
I thought about that, but it complicates things, is not inherently safe, and also introduces significant latency (assuming the monitoring process always does the reset). It would probably at least be a good idea to switch lines 551 and 552, though. I forgot to do that. |
I've found gproc_pool very flexible vs other pool libraries, but found this behaviour
After killing the process, worker stay busy forever. I look through the code and found that it is expected behaviour. Am I right? Are there any plans to improve it?
The text was updated successfully, but these errors were encountered: