Open fisher60 opened 1 year ago
This issue seems very similar to #541
Pretty confident that this isn't #541 - that was a specific bug from like, almost 4 years ago now.
If anything, I'd think that #14544 would have helped here. Can you try this with Terminal Preview (v1.17), and see if that fixes this/?
This issue is still reproducible for me on preview version 1.17.1023
Repro steps from #15708
- Create a folder and clone my sample repro:
npx degit https://github.com/jsoldi/windows-terminal-bug
. It's just a plain server that does nothing.- Do
npm install
- Open the Windows Terminal on the project folder and run
npm start 3000
and then visitlocalhost:3000
on a browser.- Close the terminal.
- Reload
localhost:3000
and the server should still be runningIf the process actually stops, try repeating steps 3-5 one more time.
I think it's important to highlight that this only seems to occur with npm projects. The process will actually stop either if I run the script directly with node index.js
, or if I do npm start
from CMD or PS, so somehow the combination of terminal and npm seems to cause the issue.
Another repro:
1.17.11461.0, 10.0.19044.3086, node v18.15.0
Steps to reproduce
- open terminal
- split pane (shift+alt+-)
- run node (npm run dev)
- close terminal (alt+f4 or
X
button)
If I run npm in a PS command, I observe this same behavior:
wt new-tab pwsh -c "& {npm run start}"
If I run npm in a PS job, the background job is terminated correctly when I close the pane/tab/window
wt new-tab pwsh -c "& {Start-Job {npm run start}}"
Same here with the PS command. I was debugging a ps1 script and noticed that each time I run it the port number increments. Then I had to go to the task manager and manually kill 20+ node processes... .__. This is weird.
Why is this bug not getting more attention? It makes the terminal completely useless for anything other than very specific toy projects and people unaware of the bug will get their system resources slowly eaten up until things start failing.
Tried to recreate the bug with different methods. As both #15708 and #15801 mentioned, running the provided repo through node
directly doesn't trigger the behavior. Using yarn
, instead of npm
, also doesn't trigger this behavior.
This bug is kind of scary, to be honest. I started a project and then when I thought the server was closed it was still running (after 7h that I first closed the terminal). I checked everything and found nothing. But then the last shot was looking into the Process Explorer and bang: node.js still running initialized by command line npm start.
Hey can anyone check if this still repros on 1.22 Preview/? We did some improvements to the way we generate CTRL_CLOSE events over the last couple of releases, and we're pretty confident we're doing it right now. Thanks!
I am still experiencing this issue on the 1.22 preview (specifically v1.22.2362.0). In my case I am running a local server for a Angular website. The development server will persist after the terminal is exited.
This is still happening on preview version 1.22.2702.0. To replicate just run npm run start
from the terminal, where package.json
contains "scripts": { "start": "node ./index.js" }
and index.js
is:
// index.js
import express from 'express';
const app = express();
const port = 3000;
app.get('/', (req, res) => { res.send('Hello World'); });
app.listen(port, () => { console.log(`Server is running at http://localhost:${port}`); });
Then close the terminal and the server will still be running.
Windows Terminal version
1.16.10261.0
Windows build number
10.0.19045.0
Other Software
Node.js v16.14.2
Steps to reproduce
npm run start
to run a local website with React)x
button on the windows terminal window to exit windows terminalExpected Behavior
When quitting windows terminal, background processes should be stopped. The local server running the React website should also be terminated when windows terminal exits.
Actual Behavior
Background process continues running indefinitely. Task manager does not indicate any windows terminal tasks running in the background. The background task appears to be buried and is difficult to discover so the easiest way to terminate the process is to restart the machine. Restarting the machine terminates the background process and website is no longer hosted.