microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
94.95k stars 8.22k forks source link

Rapid background palette changes can make Windows Terminal hang #17734

Open j4james opened 4 weeks ago

j4james commented 4 weeks ago

Windows Terminal version

1.21.1772.0

Windows build number

10.0.19045.4780

Other Software

No response

Steps to reproduce

Run the following python script:

import sys

for j in range(21845):
  i = j*3 
  r,g,b = i,i+1,i+2
  seq = '\033]11;rgb:%04x/%04X/%04x\033\\' % (r,g,b)
  sys.stdout.write(seq)
  sys.stdout.flush()

sys.stdout.write('\033]11;rgb:00/00/00\033\\')

Expected Behavior

The background color should fade from black to white, then reset to black and exit. The terminal should still work at that point.

Actual Behavior

The background fade works, but the terminal become unusable once the script has finished. None of the tabs work, and the title bar eventually shows "(Not Responding)".

I briefly looked at this in the debugger, and it appeared that it was triggering some sort of theme update event whenever the background changed, and I suspect it may have just got overloaded with a backlog of those events.

carlos-zamora commented 3 weeks ago

I briefly looked at this in the debugger, and it appeared that it was triggering some sort of theme update event whenever the background changed, and I suspect it may have just got overloaded with a backlog of those events.

Thanks for filing! We think this may be straightforward to do if we debounce the term control notification.