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

Clean up state passer state and tests #39

Merged
merged 8 commits into from
Aug 22, 2014
Merged

Clean up state passer state and tests #39

merged 8 commits into from
Aug 22, 2014

Conversation

ebroder
Copy link
Contributor

@ebroder ebroder commented Aug 19, 2014

Stop recording state passers as children (they exit immediately so they don't really count), and update the tests to pass on Ruby 2.0 and 2.1

I'm still a little concerned that they weren't getting cleaned up automatically.

As far as I can tell, POSIX specifies that signal handlers get reset to their default on exec when there was previously an explicit handler set; for SIGCHLD, this should result in dead children staying around as zombies until they're reaped by the parent. Meanwhile, the einhorn main loop should have more or less reaped any children that could be wait()ed on immediately after the reexec. POSIX leaves the option (which Linux exercises) to preserve the SIGCHLD handler as SIG_IGN if it's explicitly set to that, but einhorn doesn't do that - it sets an explicit handler.

Can einhorn reap a child after spawning the state-passer but before re-execing? Is it possible that Einhorn.can_safely_reload? somehow results in other processes getting reaped?

Also, getting the tests to pass was kind of ridiculous. I'm blown away that 1.8.7, 1.9.3, 2.0.0, and 2.1 all come up with different YAML serializations of the same hash

r? @antifuchs

@ebroder
Copy link
Contributor Author

ebroder commented Aug 22, 2014

Aha. After some extensive digging with @zenazn, it looks like this happens when you use a reexec-as command that goes through bash. bash seems to pretty religiously reap its children. Since the state passer dies pretty quickly (generally before the parent even gets a chance to reexec), the bash process ends up reaping the child, leaving einhorn with no history of the child.

@zenazn
Copy link
Contributor

zenazn commented Aug 22, 2014

👍 LGTM!

@ebroder ebroder merged commit a18e09b into contribsys:master Aug 22, 2014
@ebroder ebroder deleted the state-passer branch August 22, 2014 06:08
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

3 participants