Skip to content
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

Fix when fork used in non-main thread #4

Merged
merged 2 commits into from
May 23, 2013

Conversation

mjtko
Copy link
Contributor

@mjtko mjtko commented May 22, 2013

If a process forks from a thread that is not Thread.main, the dynamic variables are not copied to the subprocess, resulting in breakage should anything in the subprocess call structured warnings code, such as use of the overridden Kernel#warn. This is due to the fact that Thread.main in a forked process is inherited from Thread.current in the forking process, and no other threads are copied.

This PR includes a failing test and a fix that uses a singleton class level instance variable to provide the 'main' dynamics Hash rather than relying on Thread.main remaining the same object within forked subprocesses.

schmidt added a commit that referenced this pull request May 23, 2013
Fix when fork used in non-main thread
@schmidt schmidt merged commit 114d409 into schmidt:master May 23, 2013
@schmidt
Copy link
Owner

schmidt commented May 23, 2013

Thanks for your work. I'll release a new version, as soon as I have time to test this extensively.

Released with v0.2.0

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.

None yet

2 participants