Closed shajra closed 9 months ago
Hold off on accepting this pull request. I'm finding that it's killing my CPU "helper" process after a minute or so past starting up. It's the difference between a process intended to be a daemon and one that isn't.
But I think the bones of a fix are here.
This commit should also work: 64a6e0d0017cd0bff4926ad4ded6d0c0b458e69d can you confirm?
The cpu helper is killed because of the new alarm(60)
call I am doing to prevent processes from taking longer than 60s to execute. Simply call alarm(0)
in your helper startup function to remove the SIGALARM.
Nice, let me try all of this. Definitely cleaner. Shouldn't take long to validate everything.
I'm closing this pull request, because the fix that hit mainline is cleaner.
This is a proposed fix for #12.
When forking processes, we need to make sure that some cleanup is done for when they complete. Otherwise, they will become defunct (zombies).
One approach is to wait for them to finish, but we are trying to have completely async processing, so the alternative is to register a signal handler for child processes, which is what this commit does.
I tested this out on my configuration, and it seems to work. However, I want to be honest and upfront that I used ChatGPT to guide me through some of the bits and pieces. When it comes to C, I'm a tourist.