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

Exit on EPIPE #1393

Merged
merged 1 commit into from
Oct 26, 2017
Merged

Exit on EPIPE #1393

merged 1 commit into from
Oct 26, 2017

Conversation

pchaigno
Copy link
Contributor

Fixes #1010.

/cc @brendangregg

if e.errno == errno.EPIPE:
exit()
else:
raise e
Copy link
Collaborator

Choose a reason for hiding this comment

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

The callback function can be arbitrary user function here. Why you single out EPIPE errno from
another other exceptions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the developer makes a mistake in his callback function (say, write to a file on which she doesn't have permissions), we want to display the usual traceback, no?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Any exception should already have a traceback here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. If I exit on every exception (or ignore some), these tracebacks won't be displayed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

So why the exit for errno.EPIPE? If you have an example of callback function and/or lost_cb function, probably it is easier to try and understand your point?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The goal is to properly exit when receiving EPIPE or SIGPIPE as described in #1010.
If you take the example from #1010, when running ./opensnoop.py | head, it will display 10 lines then exception tracebacks for each new line without exiting because of the EPIPE Exception. With the present pull request it will properly exit (call cleanup and not display a traceback) on the first EPIPE Exception.

Copy link
Collaborator

@yonghong-song yonghong-song left a comment

Choose a reason for hiding this comment

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

Sorry I missed the original pointer to the issue number. The change looks good to me. Thanks for the fix!

@4ast 4ast merged commit fbbe6d6 into iovisor:master Oct 26, 2017
@pchaigno pchaigno deleted the handle-epipe branch October 26, 2017 04:49
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.

3 participants