-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[feature request] Add extra information for known error codes from WSL #12410
Comments
This is where we print the error message: terminal/src/cascadia/TerminalConnection/ConptyConnection.cpp Lines 387 to 397 in 7734cd7
This is somewhere similar in ConPTY connection where we print a specific message for a specific error, terminal/src/cascadia/TerminalConnection/ConptyConnection.cpp Lines 369 to 375 in 7734cd7
https://stackoverflow.com/a/17387176/1481137 might be useful, but I don't think that works for HRESULTS |
Usually if the exit status of a normal Windows process is an Functions that return Error messages for most >>> flags = win32con.FORMAT_MESSAGE_FROM_HMODULE | win32con.FORMAT_MESSAGE_IGNORE_INSERTS
>>> hmod = win32api.GetModuleHandle('ntdll')
>>> langid = win32api.MAKELANGID(win32con.LANG_NEUTRAL, win32con.SUBLANG_DEFAULT)
>>> win32api.FormatMessage(flags, hmod, 0xC000013A, langid, None)
'{Application Exit by CTRL+C}\r\nThe application terminated as a result of a CTRL+C.\r\n' There are some >>> flags = win32con.FORMAT_MESSAGE_FROM_SYSTEM | win32con.FORMAT_MESSAGE_IGNORE_INSERTS
>>> win32api.FormatMessage(flags, 0, 0xC0090001, langid, None)
'The specified event is currently not being audited.\r\n' |
For me. these WSL crashes happen sometimes during normal work, not at initialization without me hitting Ctrl+C. In any case, these crashes are likely linked to insufficient available RAM or to hard disk being too slow to respond / failing (especially during RAM paging process) - maybe the OS oom-kills the WSL process somehow. But in any case, extra textual info (+maybe a website link explaining more?) would be very helpful |
The error message for the exit status code isn't likely to help, especially if it's just |
Hmm, my slow laptop also started to have keyboard failing. Now I get this WSL crash whenever I hit the key "b". I wonder if my keyboard somehow turned itself into the mode where it sends Ctrl+Break. Indeed, the faulty key B now produces |
So maybe if Ctrl+Break is hit and this causes WSL process to terminate, should this lead to the tab being closed? A similar case happens when one hits Ctrl+D to exit a terminal (this would be the outcome on Gnome Terminal), Terminal executes |
You can configure the termination behavior in the settings for a profile or the default profile to one of the following options: close always; close on successful exit (0); or never close.
The exit status for Ctrl+D should be 0, not 255. In Unix, the closest to Windows Ctrl+Break is the terminal quit signal, which for me in Linux (not WSL) is Ctrl+\ (check I don't know why WSL doesn't map the break event to the pty quit signal instead of letting the default handler exit with |
Most of time it's indeed 0, and Ctrl+D closes the tab automatically, but sometimes I evidence code 255, not sure why :/ |
I also got a nice one:
A tab was hung for a while, and during this time all other tabs were not responsive. Then I got this message and other tabs got unhung. It's as if Terminal performed some IO to WSL backend via a single thread that can be hung |
Maybe also Terminal could print sth like "Press Ctrl + Shift + W to close this tab " for better keystroke discoverability |
Hey look at that, we were already tracking this in /dup #7186. Thanks! |
Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report! |
Currently, WSLv1 session just died at me with: |
Yep, the issue that this was duped too is in fact, still open. |
Also, may be clearer if that issue name is also expanded to reflect more than just errors on connection to conpty |
@vadimkantorov That sounds like something that should be reported to https://github.com/microsoft/wsl. We can only surface the information given to us - and an error code of
That's in a PR that you've commented on 😉 |
Mainly I'm concerned here to have a good error message. I'm not understanding deep enough to understand what exactly is failing here and at what level, so I thought maybe it's some special tool that Terminal is invoking to create a WSL session. If it's just calling wsl.exe, it might be worth it to solve crash / return code of wsl.exe at the Terminal level and have a generic "WSL session failed" at least. Of course a more specific message may be shown if WSL returns a more specific error code |
I mean, you could also just set
You may also be seeing #16068. Not sure how far back we backported that. |
Well, what was strange that it did not work once, but then worked. So maybe this mechanism just is not 100% reliable |
Yeah, it happened again. Two times auto-closing did not work, but then worked again. And when it works, it first prints this error message So it seems this autoclose is enabled by default but is certainly random/not reliable |
It's a lot less random than it seems! Most shells project their last subprocess' exit code when they themselves exit. It also so happens that You can see this behavior consistently in cmd, bash and zsh, but not with PowerShell. cmdbashzshpwshThe "graceful" close-on-exit policy explicitly prefers keeping a tab open when it exits with an error. This includes expected errors like 9009 when you've just run a command that doesn't exist or pressed Ctrl+C in cmd. |
I think che current behavior that terminal's tab should close-on-exit or not close-on-exit, depending in fact on behavior of previously run command is very unintuitive, especially as default behavior. So I would propose to switch to "always" close-on-exit. If this is absolutely not possible, I guess my a ask would be to add this information (+ some info on this close-on-exit and mode differences, reason of this show exit code and how to change it) to the printed message next to
|
Another extra proposed solution: Now, it's super funny, as stroking Ctrl+D in WSLv1 tab after command-not-found still prints 127 error code and invites to stroke Ctrl+D one more time :)
so currently Ctrl+D sends |
Just received the following:
Seems to be printed by the Terminal? If |
Terminal produced the "process exited" and "You can now close this terminal" messages. Terminal is only aware of the exit code You should file a request for better error messages on the WSL repository. |
Original message: #12360 (comment)
Sometimes WSL backend crashes and I get messages
[process exited with code 3221225786]
. It would be useful for Terminal to print extra information about known error codes (at least from WSLv1 and other Microsoft backends). It would also be good to propose the user to restart the tab by hitting Enter.The text was updated successfully, but these errors were encountered: