Conversation
Count spawned/exited/vanished/killed workers in the "parallel.forks" family, in both the pooled and the supervised implementations. Counters are process-wide as in Httpev, several run_forks calls are not told apart. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A child inherits a snapshot of the Var registry, so a worker reporting its own stats would emit the parent's fork counts frozen at fork time. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
rr0gi
approved these changes
Sep 29, 2026
rr0gi
left a comment
Contributor
There was a problem hiding this comment.
i think better add counters to do_stop, this way can see when workers are exiting slowly / not uniformly. You decide
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a
parallel.forksVarfamily to gain observability on workers forked byParallel.run_forks. Counted per event:spawned— worker was forkedexited— terminated normally, on its own or on SIGTERM from the parentkilled— worker did not stop in time and was SIGKILL'edvanished— crashed, or exited with non-zero statusWe already have startup and termination event sent by the processes themselves, which I believe duplicates the work of
spawnedandexited, so let me know if I should clean those up. Workers that getkilledor thatvanishedpresumably don't get to write this termination event.I decided to imitate
httpev.forksin that the counters are process-wide and severalrun_forksin the same process cannot be told apart. I also haven't allowed passing a~attrsor something to customize the vars in each call. Let me know if you would want something different.I wasn't sure on whether to reset the counters in forked children via
Nix.register_on_forkso I've done it in a separate commit, which I can drop easily.See https://ahrefs.slack.com/archives/C01NT4U32JD/p1790263319380559