-
-
Notifications
You must be signed in to change notification settings - Fork 651
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 double panic lockup in clients panic handler #1433
Conversation
When the pty the client was running in disappears, reading from stdin causes a panic, which triggers the custom panic handler. This handler attempts to print a backtrace to the terminal and tries to unset the raw mode for that. Since the pty has already disappeared, the tcsetattr call fails and causes a second panic, which locks everything up. This commit fixes this by returning an Result from the unset_raw_mode function, allowing the calling panic handler to handle any error gracefully.
Since we are now aware of the fact that panics may happen / are handled after the pty has disappeared, logging them to file seems useful: there is no other other place to show them to the user.
@jaeheonji in case you want to have a look, I solved the problem by returning a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGMT. This can prevent panic
from falling into a loop.
Of course, perhaps, the output for errors in unset_raw_mode
can be unkind, but this would be a very rare case. And I don't think it's a big deal.
What do you mean? Ugly to handle for the programmer? |
Almost the same, maybe compared to the |
Ah, you mean the logging of errors in the logfile?
It may not be pretty, but I think it includes all necessary information to analyze the issue. |
Cool! I agree :) |
#1326
#1414