Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

Killing webpack-serve leaves an extra node http server running on Win10 #37

Closed
1 of 3 tasks
cjmoran opened this issue Mar 3, 2018 · 4 comments
Closed
1 of 3 tasks

Comments

@cjmoran
Copy link

cjmoran commented Mar 3, 2018

  • Operating System: Win 10 x64
  • Node Version: v9.6.1
  • NPM Version: 5.6.0
  • webpack Version: 4.0.1
  • webpack-serve Version: 0.1.5

This issue is for a:

  • bug
  • feature request
  • modification request

Code

CLI Command
  $ webpack-serve ./webpack.config.js
webpack.config.js

https://gist.github.com/cjmoran/7d220cf0616b6ffcd96614ace23e3202

Expected Behavior

Hitting Ctrl+C in my console while running webpack-serve will kill webpack-serve, including the node server it's running.

Actual Behavior

Hitting Ctrl+C in my console kills webpack-serve and the terminal exits the program, but I can see one of its two Node.js processes stick around in task manager.

This means that next time I go to start the server, I'll be met with this error:

✖ 「serve」:  { Error: listen EADDRINUSE 127.0.0.1:8080
    at Object._errnoException (util.js:1003:13)
    at _exceptionWithHostPort (util.js:1024:20)
    at Server.setupListenHandle [as _listen2] (net.js:1353:14)
    at listenInCluster (net.js:1394:12)
    at GetAddrInfoReqWrap.doListen [as callback] (net.js:1509:7)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:102:10)
  errno: 'EADDRINUSE',
  code: 'EADDRINUSE',
  syscall: 'listen',
  address: '127.0.0.1',
  port: 8080 }
ℹ 「hot」: webpack: Compiling Done

webpack-serve is able to continue running and host files after this, which is commendable, but every restart also leaves yet another node exe running and eating memory in the background: https://i.imgur.com/HMVXwbE.jpg

How Do We Reproduce?

Start webpack-serve on Windows 10 (using Git Bash included with the official Git client), hit Ctrl+C to kill, then start again and see if you get the 'port in use' error.

@shellscape
Copy link
Contributor

Thanks for the issue 🍺 Unfortunately we're already using what's available to us to determine if the process should end, and we've got the right sequence of handlers in place to end the server. You can view that code here:

webpack-serve/index.js

Lines 65 to 73 in 8d160d8

for (const sig of ['SIGINT', 'SIGTERM']) {
process.on(sig, () => { // eslint-disable-line no-loop-func
close(() => {
log.info(`Process Ended via ${sig}`);
server.kill();
process.exit(0);
});
});
}

Windows unfortunately still sucks at the console/terminal. webpack-dev-server would see an issue on this reported every few months fairly regularly. If you can figure out a fix for your env on windows, we'd happily welcome a Pull Request.

@shellscape
Copy link
Contributor

We're closing this issue as stale as it's more than 30 days without activity, and without an associated Pull Request. Please feel free to continue discussion. We'll reopen this issue if anything actionable is posted.

@shellscape
Copy link
Contributor

This was resolved in #110

/cc @ulivz

@ulivz
Copy link

ulivz commented May 13, 2018

Thanks a lot ! @shellscape

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants