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

Tools: properly handle the keyboard interrupt #2083

Merged
merged 1 commit into from
Dec 19, 2018

Conversation

jeromemarchand
Copy link
Contributor

Many tools rely on the user to type Ctrl-C to end, but don't actually
catch the keyboard interrupt and thus show an ugly backtrace when it
happens. Let's catch the interrupt.

Many tools rely on the user to type Ctrl-C to end, but don't actually
catch the keyboard interrupt and thus show an ugly backtrace when it
happens. Let's catch the interrupt.
@palmtenor
Copy link
Member

[buildbot, ok to test]

@yonghong-song
Copy link
Collaborator

Could you share the ugly backtrace you have seen? I am curious what it is.
It would be interesting to know in what situations you could see these kinds of backtraces.

I have seen situations where there are so many events (e.g., through trace.py tracing t:raw_syscall:sys_enter), it seems stuck inside the loop in function perf_reader_event_read()
and Ctrl-C even fails and I have to do Ctrl-Z. I guess this is probably different from your situation.
I tried a few applications it seems all generate sane tracebacks.

@jeromemarchand
Copy link
Contributor Author

By ugly backtrace, I mean any backtrace. The backtraces don't show anything wrong and the program usually exit right away (the only exception I've seen is in funcslower where I often need to hit Ctrl-C several times to quit - but that's another story). It just that users don't like to see error message when they quit a program.

@yonghong-song
Copy link
Collaborator

Yes. We may have a few other places, e.g., trace.py, we also need to add this change. But this can be done separately.

@yonghong-song yonghong-song merged commit 5167127 into iovisor:master Dec 19, 2018
palexster pushed a commit to palexster/bcc that referenced this pull request Jul 7, 2019
Many tools rely on the user to type Ctrl-C to end, but don't actually
catch the keyboard interrupt and thus show an ugly backtrace when it
happens. Let's catch the interrupt.
@jeromemarchand jeromemarchand deleted the ctrl-c branch August 5, 2019 16:02
CrackerCat pushed a commit to CrackerCat/bcc that referenced this pull request Jul 31, 2024
Many tools rely on the user to type Ctrl-C to end, but don't actually
catch the keyboard interrupt and thus show an ugly backtrace when it
happens. Let's catch the interrupt.
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