Skip to content

Clean up partially created process workers - #387

Merged
grosser merged 1 commit into
grosser:masterfrom
OskarEichler:codex/cleanup-partial-process-workers
Aug 30, 2026
Merged

Clean up partially created process workers#387
grosser merged 1 commit into
grosser:masterfrom
OskarEichler:codex/cleanup-partial-process-workers

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

Summary

Close partial pipes and stop/reap child processes when worker creation fails, including workers created before a later failure.

An external injected-failure model passes on Ruby 4.0.6 and 3.2.11. Diff and syntax checks pass. Source only; repository tests are unchanged.

Comment thread lib/parallel.rb
workers << worker(job_factory, options.merge(started_workers: workers, worker_number: i), &block)
end
workers
rescue Exception # rubocop:disable Lint/RescueException

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems good/clean, a test would be nice though
(make workers have some side-effect + make em crash -> no sideeffect observed)

Comment thread lib/parallel.rb
child_write.close

Worker.new(parent_read, parent_write, pid, options[:serializer])
rescue Exception # rubocop:disable Lint/RescueException

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here ... I'll add them

@grosser
grosser merged commit 65664a2 into grosser:master Aug 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants