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
When developing in WSL and running apps locally (such as Python or Node.js apps) from WSL, it seems that multiple apps can be started on the same port from within WSL, even though I would expect EADDRINUSE to be reported.
I can reproduce this by starting a very basic Node.js (express) app on port 3000, push that app to the background, then start another. The second does not yield an error, and both are running side by side.
$catindex.jsconstexpress=require('express')constapp=express()constport=3000app.get('/',(req,res)=>res.send('Hello World!'))app.listen(port,()=>console.log(`Example app listening on port ${port}!`))
Running this and sending it to the background, then confirming the app is listening on that port:
and curl still works, but of course only receive response from one (first?) app:
$ curl http://127.0.0.1:3000/
Hello World!
Just to confirm that this is a WSL issue, leaving one (or both) of these apps running in WSL, and trying to start the same app from Windows (cmd.exe) I get the expected error:
C:\Users\Aidan Harbison\test>node index.js
events.js:174
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::3000
Expected Behavior
In WSL, trying to start multiple apps or processes that listen on the same port should yield an EADDRINUSE error.
Actual Behavior
In WSL, multiple apps or processes can be started which listen on the same port. No EADDRINUSE error is seen from WSL by starting the second or subsequent processes.
Windows build number
Microsoft Windows [Version 10.0.17763.615]
The text was updated successfully, but these errors were encountered:
Problem Description
When developing in WSL and running apps locally (such as Python or Node.js apps) from WSL, it seems that multiple apps can be started on the same port from within WSL, even though I would expect
EADDRINUSE
to be reported.I can reproduce this by starting a very basic Node.js (express) app on port 3000, push that app to the background, then start another. The second does not yield an error, and both are running side by side.
Steps to Reproduce
Using the Hello world example app from
express
:Running this and sending it to the background, then confirming the app is listening on that port:
Starting a second app yields no errors, and I can confirm both apps are running side-by-side in the process list:
and
curl
still works, but of course only receive response from one (first?) app:Just to confirm that this is a WSL issue, leaving one (or both) of these apps running in WSL, and trying to start the same app from Windows (
cmd.exe
) I get the expected error:Expected Behavior
In WSL, trying to start multiple apps or processes that listen on the same port should yield an
EADDRINUSE
error.Actual Behavior
In WSL, multiple apps or processes can be started which listen on the same port. No
EADDRINUSE
error is seen from WSL by starting the second or subsequent processes.Windows build number
The text was updated successfully, but these errors were encountered: