You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Responses to DA, DA2, background color requests get passed on to the client on Windows Terminal #4634
there are duplicated response, which cannot be explained by delay
this line of code looks suspicious, where tty->term->flags should probably be tty->flags. The bit set here and here are basically ignored. This might open a possibility for repeated requests ?
Many people seem to met similar symptom. This comment collected some related issues.
But the remaining 75 bytes are another copy of the DA and RGB response. tmux has already received the ones it requested, so it passes these on to the pane:
1757688748.908061 /dev/pts/1: keys are 75 (\033[?61;4;6;7;14;21;22;23;24;28;32;42;52c\033[>0;10;1c\033]10;rgb:cccc/cccc/cccc\033\\\033)
Can you please reproduce like this and send me the strace.out* files:
strace should let us confirm whether tmux is receiving the wrong thing (two replies to one request) from the terminal or whether it is getting confused inside tmux or libevent somewhere.
Curious, the partial key (of the incomplete background response) seems to be repeated at the beginning of the additional 79 bytes. Is it from the terminal or it is buffered and repeated by some layer in the middle ?
This seems like either the terminal, or something between the terminal and tmux (IIRC Windows has several layers?) is doing the wrong thing, or interpreting something else that tmux sends as an additional request.
ISTR something like this coming up before and I don't know if there was ever any conclusion. The issue has been confused a bit because Windows terminal seems to sometimes take a while to send replies and tmux was not waiting for long enough, but that should be fixed in master and does not seem to be what is happening here.
Curious, the partial key (of the incomplete background response) seems to be repeated at the beginning of the additional 79 bytes. Is it from the terminal or it is buffered and repeated by some layer in the middle ?
tmux is printing its entire key buffer, it includes what it already had, so here:
tmux read 79 bytes to go with the 21 it already had in the buffer. And:
1757688748.908030 /dev/pts/1: keys are 100 (\033]11;rgb:0c0c/0c0c/0c0c\033\\\033[?61;4;6;7;14;21;22;23;24;28;32;42;52c\033[>0;10;1c\033]10;rgb:cccc/cccc/cccc\\
033\\\033)
This is the entire data tmux now has available to process, both the existing 21 bytes and the new 79 bytes, so 100 bytes total (that's the "are 100" bit). It is the bit after the now-complete background response that is incorrect.
OK, so it is working as expected outside tmux. So either 1) it is interpreting something else that tmux sends as an additional request or 2) the bug is only triggered when the terminal is in a mode that tmux sets.
Can you try this program test.c.txt? Rename it to test.c, build it with make test and then run it with ./test. You should be able to exit it by pressing Enter. Let me know what it shows.
ISTR something like this coming up before and I don't know if there was ever any conclusion.
Maybe this one #2984
Yes, I also feel it is different, as there is no delay in this issue.
Or this PowerShell/Win32-OpenSSH#2275 (comment)
suspecting Windows Terminal sends response in 2 separate TCP packets. But the separate packets seem to be handled well with tmux buffer as you just explained.
tmux read 79 bytes to go with the 21 it already had in the buffer
OK. I can't see anything in what tmux is sending that could cause this, and when I try the same program in xterm it is fine.
You could try removing sequences from the #define S line and try to narrow down what is causing it.
If you find it, we may be able to stop tmux sending it, but think for a proper fix you will need to report this to the terminal developers and see if they can help.
With some lookup, \033[?1049h means Enables the "alternate screen buffer." But "buffer" sounds like something within the same terminal. Receiving repeated response still sounds strange.
FYI I'm also tracking down this issue as the maintainer of Windows Terminal1.
It turns out that there is an issue in the Windows SSH client that results in it reusing a send buffer when reporting a SIGWINCH to the remote end. The Windows console sends a window size change signal when the alternate buffer is enabled or disabled2, and so a packet that combines enabling the ASB with e.g. a DA1 request trigger the race condition more often.
We have seen a number of similarly hostile responses from the above user. I'm sorry about that. ↩
the active region of the terminal can change in certain conditions due to the addition or deletion of a scroll bar or other UI elements; I don't know why we always send it rather than only when there's a true change. ↩
Activity
nicm commentedon Sep 12, 2025
Does this still happen if you build tmux from master?
You are right it is using the wrong
flags, will fix that.diffuty commentedon Sep 12, 2025
Yes, it still happens on master.
Also saw your fix already. That was so quick.
So tested on commit 3e28777ecbc8de3df803d5d7429a5ecd35f61553 which includes the fix as well. Unfortunately the symptom still happens.
nicm commentedon Sep 12, 2025
Show server log from reproducing with master.
diffuty commentedon Sep 12, 2025
tmux-client-11159.log
tmux-out-11161.log
tmux-server-11161.log
nicm commentedon Sep 12, 2025
This seems like a bug in the terminal you are using. Unless I am missing something, tmux sends the requests once:
It receives a response and processes it:
After that there are 21 bytes left with the unfinished background response:
Then we get an additional 79 bytes. The start of this completes the background:
But the remaining 75 bytes are another copy of the DA and RGB response. tmux has already received the ones it requested, so it passes these on to the pane:
Can you please reproduce like this and send me the
strace.out*files:nicm commentedon Sep 12, 2025
straceshould let us confirm whether tmux is receiving the wrong thing (two replies to one request) from the terminal or whether it is getting confused inside tmux or libevent somewhere.diffuty commentedon Sep 12, 2025
Renamed files with a
.logsuffix so github allow them uploaded.strace.out.11256.log
strace.out.11257.log
strace.out.11258.log
strace.out.11259.log
strace.out.11260.log
strace.out.11261.log
strace.out.11262.log
strace.out.11263.log
strace.out.11264.log
strace.out.11265.log
strace.out.11266.log
strace.out.11267.log
diffuty commentedon Sep 12, 2025
Curious, the partial key (of the incomplete background response) seems to be repeated at the beginning of the additional 79 bytes. Is it from the terminal or it is buffered and repeated by some layer in the middle ?
nicm commentedon Sep 12, 2025
OK it looks like
strace.out.11258.logis the tmux server.And fd 5 is the pty:
I only see one request:
And we get back two responses:
Followed by what looks like you pressing
C-b C-k C-d?This seems like either the terminal, or something between the terminal and tmux (IIRC Windows has several layers?) is doing the wrong thing, or interpreting something else that tmux sends as an additional request.
If you do this outside tmux:
What do you see?
nicm commentedon Sep 12, 2025
ISTR something like this coming up before and I don't know if there was ever any conclusion. The issue has been confused a bit because Windows terminal seems to sometimes take a while to send replies and tmux was not waiting for long enough, but that should be fixed in master and does not seem to be what is happening here.
nicm commentedon Sep 12, 2025
tmux is printing its entire key buffer, it includes what it already had, so here:
tmux read 79 bytes to go with the 21 it already had in the buffer. And:
This is the entire data tmux now has available to process, both the existing 21 bytes and the new 79 bytes, so 100 bytes total (that's the "are 100" bit). It is the bit after the now-complete background response that is incorrect.
diffuty commentedon Sep 12, 2025
Yes,
C-ato go beginning of line,C-kto clear the line after the cursor (which is the DA, etc),C-dto exit bash, thus tmux.nicm commentedon Sep 12, 2025
OK, so it is working as expected outside tmux. So either 1) it is interpreting something else that tmux sends as an additional request or 2) the bug is only triggered when the terminal is in a mode that tmux sets.
Can you try this program test.c.txt? Rename it to
test.c, build it withmake testand then run it with./test. You should be able to exit it by pressingEnter. Let me know what it shows.diffuty commentedon Sep 12, 2025
Maybe this one #2984
Yes, I also feel it is different, as there is no delay in this issue.
Or this PowerShell/Win32-OpenSSH#2275 (comment)
suspecting Windows Terminal sends response in 2 separate TCP packets. But the separate packets seem to be handled well with tmux buffer as you just explained.
Good to know. Thanks.
nicm commentedon Sep 12, 2025
Please try this one instead which sends the same as tmux actually sends: test2.c.txt
diffuty commentedon Sep 12, 2025
Great!
Tried multiple times:
Most frequently it repeat twice:
Occasionally 3 times:
Occasionally once:
nicm commentedon Sep 12, 2025
OK. I can't see anything in what tmux is sending that could cause this, and when I try the same program in xterm it is fine.
You could try removing sequences from the
#define Sline and try to narrow down what is causing it.If you find it, we may be able to stop tmux sending it, but think for a proper fix you will need to report this to the terminal developers and see if they can help.
diffuty commentedon Sep 12, 2025
Shortest sequence I found:
\033[?1049h\033[cwith output:
Modified code: test2-1.c.txt
With some lookup,
\033[?1049hmeans Enables the "alternate screen buffer." But "buffer" sounds like something within the same terminal. Receiving repeated response still sounds strange.nicm commentedon Sep 12, 2025
You can prevent tmux switching to the alternate screen by doing:
diffuty commentedon Sep 12, 2025
Tried 20 times in a row with this config on a
masterbuild, and didn't observe the sequence.3.5adoes not have the luck though.Thanks a lot for all the effort replying and debugging to narrow it down !
Opened an issue for Windows Terminal, and closing this one.
giuliohome commentedon Oct 4, 2025
nicm commentedon Oct 4, 2025
nicm commentedon Oct 4, 2025
giuliohome commentedon Oct 4, 2025
DHowett commentedon Oct 6, 2025
FYI I'm also tracking down this issue as the maintainer of Windows Terminal1.
It turns out that there is an issue in the Windows SSH client that results in it reusing a send buffer when reporting a
SIGWINCHto the remote end. The Windows console sends a window size change signal when the alternate buffer is enabled or disabled2, and so a packet that combines enabling the ASB with e.g. a DA1 request trigger the race condition more often.The main tracking issue is currently PowerShell/Win32-OpenSSH#2275.
Footnotes
We have seen a number of similarly hostile responses from the above user. I'm sorry about that. ↩
the active region of the terminal can change in certain conditions due to the addition or deletion of a scroll bar or other UI elements; I don't know why we always send it rather than only when there's a true change. ↩
giuliohome commentedon Oct 6, 2025
I no longer intend to assist Microsoft with any issues.
You should be thankful I reported that one at all.
In any case, it wasn’t even worth using tmux.
github-actions commentedon Nov 6, 2025
This issue has been automatically locked since there has not been any recent activity after it was closed.