microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.4k stars 819 forks source link

WSL2 localhost access is intermittent with stuck connections #4340

Closed benc-uk closed 4 years ago

benc-uk commented 5 years ago

Please fill out the below information:

Opening a URL served via a Node.js app using localhost, from a Windows browser results in page/URL never loading. It will spin indefinitely trying to load, rather than getting an error that site/page can not be found

Hitting stop and then refresh in browser will result in page loading OK Page will continue to load OK, if you send requests to it quickly, if you wait a few seconds the problem will return and the URL and site will never load

I have verified the following:

This seems to be a TCP socket issue with the way WSL 2 handles the new localhost bridging out to Windows

It is trivial to reproduce. Install Node.js and run the following simple server

const http = require('http')
const requestHandler = (request, response) => {
  console.log(`### Request for ${request.url}`)
  response.end('<h1>Hello Node.js Server!</h1>')
}
const server = http.createServer(requestHandler)
server.listen(3000, '0.0.0.0', (err) => {
  if (err) return console.log('### Something bad happened', err)
  console.log(`### Server is listening on 3000`)
})

See our contributing instructions for assistance.

khuongduybui commented 1 year ago

Yes it just came back in the latest Windows update on Dev channel for me.

illepic commented 1 year ago

Edit: Downgrade to 1.0.3: https://github.com/microsoft/WSL/issues/9508

ghost commented 1 year ago

@illepic, @khuongduybui: If you're experiencing problems on 1.1.0 please see issue #9508. This issue covers 1.0.3 and before.