Skip to content

Add a crash-handler.wait-pipe-close parameter #1092

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

Merged

Conversation

deweerdt
Copy link
Member

If this parameter is set to true, the crash handler will wait until the
pipe opened to the crash handler is closed by it. This is useful if the
crash handler is ptracing the main process in order to get more
information.

If this parameter is set to true, the crash handler will wait until the
pipe opened to the crash handler is closed by it. This is useful if the
crash handler is ptracing the main process in order to get more
information.
@kazuho
Copy link
Member

kazuho commented Sep 30, 2016

Thank you for the PR. Before going into the details, please let me understand the background.

I would like to know the reason you are using ptrace from the crash handler. Do you start ptrace-ing when the server process crashes?

@deweerdt
Copy link
Member Author

I would like to know the reason you are using ptrace from the crash handler. Do you start ptrace-ing when the server process crashes?

Yes, that's correct, on SIGSEGV we ptrace the crashing process and extract debugging information.

@deweerdt
Copy link
Member Author

deweerdt commented Oct 4, 2016

Updated to use poll(2) instead of write(2) to detect the pipe closing.

@deweerdt deweerdt force-pushed the add-a-crash-handler-wait-pipe-close-parameter branch from 878a846 to 58076aa Compare October 5, 2016 15:16
struct pollfd pfd[1];
pfd[0].fd = crash_handler_fd;
pfd[0].events = POLLERR | POLLHUP;
poll(pfd, 1, -1);
Copy link
Member

Choose a reason for hiding this comment

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

It might be wiser to check for EINTR (and call poll again in such case), considering the fact that signals other than the one that is being handled by this signal handler may preempt the execution of poll.

Copy link
Member

@kazuho kazuho left a comment

Choose a reason for hiding this comment

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

Thank you for the update, sorry for the delay.

Looks fine to me aside from the nitpicking comment.

@deweerdt
Copy link
Member Author

Done in c30db4e, thanks!

@kazuho kazuho added this to the v2.2 milestone Nov 7, 2016
@kazuho kazuho merged commit c30db4e into h2o:master Jan 18, 2017
kazuho added a commit that referenced this pull request Jan 18, 2017
Add a `crash-handler.wait-pipe-close` parameter
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