Node process freezes when text is selected in command line
- Version: v16.2.0
- Platform: Windows 10
- Subsystem: -
What steps will reproduce the bug?
- Run any Node.js script: an
http-serveror long-runningnpm install. - Select text in console window.
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
Node process should never freeze due to text selection in terminal, same as desktop application UI threads should never stop execution of application.
What do you see instead?
Server doesn't respond to requests, npm installation freezes. Whole node process does nothing.
Additional information
This is Windows-specific problem that I encountered by interacting with terminal window in a different way more than 3 years ago. Given that it's very easy to start selection on Windows just by clicking a terminal window (while switching windows, for example), it's very common to find a long-running script doing nothing after several minutes of waiting for progress. I think this is a serious UX issue.
@nodejs/platform-windows
This seems to only happen with conhost.exe.
Hi All, I am interested with node process object, can I pick this up for investigation?
@reverofevil I was not able to reproduce the issue with the latest versions of Node.js (23.2.0, 22.10.0, 20.18.0, and 18.20.4). Do you think this can be closed now?
@huseyinacacak-janea
I'll check today.
Naturally, nothing changed, and it's easily reproducible with a linked example on Node 22.10.0, Windows 10, cmd terminal.
This issue might be related to how the console displays the output as stated in this comment because in the link that you've sent, the counter increases without any problem.
I've attached my screen record to make sure I did the tests correctly.
The test seems to be done correctly, except I'd recommend selecting the text for over 10 seconds, as well as holding scrollbar for longer. First 2 lines might come through just fine, and there actually was a suspicious lag at 5-6 second mark.
That said, I don't recognize this terminal.
This is the default CMD of Windows 11. Can you record your screen and share it here?
Since the issue has been stale for some time, and in addition it doesn't look like anything Node specific, I'll close it. Feel free to reopen if needed.
doesn't look like anything Node specific
This is Node-specific bug in implementation of console.* methods.