Port conflicts do not get surfaced! Very confusing to debug.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
Version
10.0.19043
WSL Version
- WSL 2
- WSL 1
Kernel Version
5.10.102.1
Distro Version
Ubuntu 20.04
Other Software
I installed PostgreSQL 14 both on WSL and in Windows (wasn't sure which would be a better option for me). They store their data in different locations, but I configured both to run on port 5432 (the default).
I accidentally left both running at the same time (the Windows Postgres started automatically without my knowledge). My app failed to find my database tables and I realized something was wrong.
The issue was that, somehow, Postgres was running on port 5432 on Windows AND a different Postgres was running on port 5432 on WSL. I had to stop the Windows process for my app to find the WSL database.
I think there should be some port conflict error that gets surfaced when running services on the same port on WSL and Windows.
Repro Steps
Run Postgres on port 5432 on Windows and WSL at the same time. They both work, and are also, somehow, both accessible in the other environment but the Windows service seems to get connection precedence.
Expected Behavior
There should be an error like what happens when two services try to run on the same port generally.
Actual Behavior
The two services run on the same port even though it leads to unexpected behavior.
Diagnostic Logs
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported setup: run PostgreSQL on port 5432 in both Windows and WSL 2 using the listed versions, then inspect how WSL networking handles the two listeners and connection precedence. Done means a port conflict is surfaced clearly instead of both services running with unexpected routing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql
- Domain
- databases, networking, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100