-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Cursor flicker in Cygwin irssi #18264
Comments
Page faults are 0 when starting Cygwin in either Windows' cmd.exe or Cygwin's mintty.exe. |
Cygwin is calling console APIs in its steady state. It looks like it's calling I don't think there's anything we can do about that, other than stopping them from doing so Is there an issue you're troubleshooting here other than a raw increased count of page faults/? |
I am experiencing stutters and visible cursor movement during terminal screen redraws that I do not experience when using cmd.exe or mintty.exe. I will attempt to bring this issue to the Cygwin team's awareness. |
You're experiencing a graphical issue using the new Windows Terminal which uses the GPU to render things. I doubt your issue has anything to do with the console server and its soft page faults. 🙂 @lhecker What are our usual troubleshooting steps for things like this? |
The only page thrasher of that magnitude on my system at the moment appears to be MS Windows Defender! ;^> |
It would be great if there was a different solution for that. Waiting on a handle seems better than polling to me.
I think a video of the issue would be a good start. Ideally a screen recording. If a video doesn't clear up what exactly is lagging and how and when, I'd need a significantly more detailed description of the issue. |
Here is a video of the cursor flickering. On the left side is Windows Terminal without Cygwin. On the right side is Windows Terminal with Cygwin. Both terminals are running a SSH session into my Linux server where I have reattached to a TMUX session that is running WeeChat, an IRC client. Please note the annoyingly visible cursor flickering between the clock and the input location in the right-side Terminal that is running Cygwin. This cursor flickering is not present when Cygwin is running in cmd.exe or mintty.exe. untitled.mp4 |
The cursor flickering issue is over here: #6217 In the past this was not obvious because after we saw a write we would wait 16ms until we flush our internal buffers. That's also the reason why wezterm regressed: It updated to a newer ConPTY version where that 16ms was rightfully removed. One solution is to add back a slight delay, but I would prefer solving the issue in another way. |
Do you mean we cannot call Windows API (GetConsoleProcessList()) frequently? Then, how often can we call it? I also wonder why "the allocation of a new buffer" is necessary. The buffer LPDWORD lpdwProcessList is provided by caller side. |
I doubt that this is the real cause.
|
It's provided by the caller in another process. The console host does not share memory with or map memory from the caller. FWIW, Regardless, neither page faults nor this API are the reason @pragma-'s cursor is jumping between irssi's status line (updated every second) and their input line. That's just because we render the intermediate cursor position. The cursor moves to the status line when irssi overwrites it, because that's how overwriting a region of text works. Usually, it's hidden when it does that. That's almost certainly the actual root cause: somebody isn't hiding it (whether it's irssi, Cygwin's emulated TTY, or us). @pragma-, can you (thanks for sharing the video!) |
I could have reproduced the page fault with the following simple test case. Regardless of the frequency of API calls, 64 page-fault occurs every loop. Unlike cygwin case, the page fault happens also with version 1.21.3231.0.
|
@DHowett The $TERM is screen-256color in both terminals. By the way, it's weechat rather than irssi. I've customized my weechat theme to look like irssi! :-) |
Oh nice!
Oh, uh, what is |
xterm-256color |
I figured out why this happens: When we read from the console pipe, we currently need to provide a buffer where the message is copied into, similar to IMO there's 3 things we should do:
|
Currently, the buffer of 128KB is passed to GetConsoleProcessList(). This causes page fault in the select() loop for console due to: microsoft/terminal#18264 because the previous code calls GetConsoleProcessList() with large buffer and PeekConsoleInput() with small buffer alternately. With this patch, the minimum buffer size is used that is determined by GetConsoleProcessList() with small buffer passed. Addresses: https://cygwin.com/pipermail/cygwin/2024-December/256841.html Fixes: 7277014 ("Cygwin: pty: Prevent pty from changing code page of parent console.") Reported-by: Steven Buehler <[email protected]> Signed-off-by: Takashi Yano <[email protected]> (cherry picked from commit 1a49c17)
Currently, the buffer of 128KB is passed to GetConsoleProcessList(). This causes page fault in the select() loop for console due to: microsoft/terminal#18264 because the previous code calls GetConsoleProcessList() with large buffer and PeekConsoleInput() with small buffer alternately. With this patch, the minimum buffer size is used that is determined by GetConsoleProcessList() with small buffer passed. Addresses: https://cygwin.com/pipermail/cygwin/2024-December/256841.html Fixes: 7277014 ("Cygwin: pty: Prevent pty from changing code page of parent console.") Reported-by: Steven Buehler <[email protected]> Signed-off-by: Takashi Yano <[email protected]>
Now that the first two remediations are complete, we're going to mark this bug as a /dup of #6217. 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! |
Windows Terminal version
1.22.3232.0
Windows build number
10.0.19045.0
Other Software
Cygwin
Steps to reproduce
Expected Behavior
Page faults to remain at 0 or low in OpenConsole.exe while Cygwin is running.
Actual Behavior
800-2000 page faults per second in OpenConsole.exe while Cygwin is running. See video below:
10-24-34.mp4
The text was updated successfully, but these errors were encountered: