1

We have two laptops in the team experiencing the same kind if issues, but they behave a bit differently so I'll take it from the point of view of mine...

Both laptops runs updated Windows 11 with Ubuntu 20.04 in WSL2.

After a reboot everything works nicely, the development setup is:

  • DBbeaver on Windows
  • Insomnia/Postman on Windows
  • Docker Desktop on Windows with WSL2 as "runtime"
  • Postgres v12 on WSL on standard port 5432
  • Docker container listening on port 8080, connecting to Postgres (on WSL)
  • Node.js application connection to Postgres and the Docker container (http 8080). The node.js application exposes port 1337 which Insomnia (from Windows) send requests to.

So, everything runs nicely for some time, sometimes a few hours but other times only a few minutes.

We notice it by Insomnia (or Postman on the other laptop) all of a sudden gives an application error. It's not a time-out, it errors out immediately.

Checking the logs I can see in the node.js application that it gives connect ECONNREFUSED 127.0.0.1:5432 (which is the node.js application trying to access Postgres).

Then trying the Docker container on port 8080 (localhost:8080) from Insomnia (which also worked before) I get a Error: Couldn't connect to server. If I instead change localhost to the WSL IP, e.g. 172.27.128.25:8080, I get a response from the container.

Thus, localhost:1337 works, but localhost:8080 doesn't.

DBeaver connecting to the Postgres on WSL was also working nicely using both localhost and 172.27.128.25 prior to the "crash" but after the crash DBeaver gives Connection refused: connect.

Checking listening ports on both Windows and WSL it all looks ok and the application, container and Postgres are listening (8080, 1337 and 5432) and there are no "conflicts".

Connecting "locally" on WSL2 to Postgres works fine (su - postgres) and I can query DB using psql.

Resources on the laptops are fine.

What can we check? I've tried to monitor the laptops and checked Windows Event Viewer to see if there is something specific happening when it stops working, but I haven't been able to find anything... It just happens from one API request to the next...

We've already tried to disable Fast Startup for Windows and DNS fix/check for WSL which are common issues for network/localhost access. Trying to reset network and flush DNS cache, etc. isn't working to restore the connection, neither is restarting WSL, only a reboot clears it out.

Sometimes though, if I stop Docker Desktop, shutdown WSL, then start WSL and then Docker again it can work for some time, but then often only for a few minutes. A reboot normally gives us at least an hour of working before it stops... So weird...

Anders
  • 111
  • 3

0 Answers0