-
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
Make conhost act in VtIo mode earlier in startup #15298
Make conhost act in VtIo mode earlier in startup #15298
Conversation
This is a theory. I want to audit the uses of `CONSOLE_INFORMATION::IsInVtIoMode` before I commit to this. But I think this: * fixes #15245 * fixes #14512 Because basically, we'd create the first screen buffer with 9001 rows, because it would be created _before_ VtIo would be in a state to say "yes, we're a conpty"
This comment was marked as resolved.
This comment was marked as resolved.
Note for @DHowett: thinking that we shouldn't immediately service this, at least until we have some 1.18 selfhost that suggests it's safe |
src/host/VtIo.cpp
Outdated
@@ -230,7 +230,7 @@ VtIo::VtIo() : | |||
|
|||
bool VtIo::IsUsingVt() const | |||
{ | |||
return _objectsCreated; | |||
return _initialized || _objectsCreated; |
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.
Aside from EnableConptyModeForTests
, it seems like _objectsCreated
isn't needed anymore. Remove it?
My only concern is that... |
|
oop |
We need to act like a ConPTY just a little earlier in startup. My relevant notes start here: #15245 (comment). Basically, we'd create the first screen buffer with 9001 rows, because it would be created _before_ VtIo would be in a state to say "yes, we're a conpty". Then, if a CLI app emits an entire screenful of text _before_ the terminal has a chance to resize the conpty, then the conpty will explode during `_DoLineFeed`. That method is absolutely not expecting the buffer to get resized (and the old text buffer deallocated). Instead, this will treat the console as in ConPty mode as soon as `VtIo::Initialize` is called (this is during `ConsoleCreateIoThread`, which is right at the end of `ConsoleEstablishHandoff`, which is before the API server starts to process the client connect message). THEORETICALLY, `VtIo` could `Initialize` then fail to create objects in `CreateIoHandlers` (which is what we used to treat as the moment that we were in conpty mode). However, if we do fail out of `CreateIoHandlers`, then the console itself will fail to start up, and just die. So I don't think that's needed. This fixes #15245. I think this is PROBABLY also the solution to #14512, but I'm not gonna explicitly mark closed. We'll loop back on it. (cherry picked from commit 6ad8cd0) Service-Card-Id: 89112504 Service-Version: 1.17
We need to act like a ConPTY just a little earlier in startup. My relevant notes start here: #15245 (comment).
Basically, we'd create the first screen buffer with 9001 rows, because it would be created before VtIo would be in a state to say "yes, we're a conpty". Then, if a CLI app emits an entire screenful of text before the terminal has a chance to resize the conpty, then the conpty will explode during
_DoLineFeed
. That method is absolutely not expecting the buffer to get resized (and the old text buffer deallocated).Instead, this will treat the console as in ConPty mode as soon as
VtIo::Initialize
is called (this is duringConsoleCreateIoThread
, which is right at the end ofConsoleEstablishHandoff
, which is before the API server starts to process the client connect message). THEORETICALLY,VtIo
couldInitialize
then fail to create objects inCreateIoHandlers
(which is what we used to treat as the moment that we were in conpty mode). However, if we do fail out ofCreateIoHandlers
, then the console itself will fail to start up, and just die. So I don't think that's needed.This fixes #15245. I think this is PROBABLY also the solution to #14512, but I'm not gonna explicitly mark closed. We'll loop back on it.
TODO
CONSOLE_INFORMATION::IsInVtIoMode
before I commit to this.