PostgreSQL 17 Service Running but Not Listening on Network Port on Windows

Started by José António Gomes10 months ago3 messagesbugs
Jump to latest
#1José António Gomes
jose.antonio.luanda@gmail.com

*Subject: PostgreSQL 17 Service Running but Not Listening on Network Port
on Windows*

*Environment:*

- *Operating System:* Windows 10/11
- *PostgreSQL Version:* 17 (Fresh Installation)
- *Testing Tools:* Windows Services (services.msc), Command Prompt (
netstat), DBeaver

*Problem Description:* A fresh installation of PostgreSQL 17 on a Windows
machine starts successfully according to the Windows Services Manager, but
the process fails to open its configured network port (5432). This makes it
impossible for any application to connect. The issue persists even after a
complete and clean reinstallation.

*Key Symptoms:*

- The postgresql-x64-17 service shows a status of *"Running"* in
services.msc.
- The postgresql.conf file is correctly configured with listen_addresses
= '*' and port = 5432.
- The command netstat -aon | findstr "LISTEN" | findstr "postgres"
returns *no output*, proving the process is not listening on any port.
- The command netstat -aon | findstr ":5432" also returns *no output*,
proving no other application is conflicting on that port.

*Troubleshooting Steps Performed:*

1. Verified the PostgreSQL service is "Running" after every
configuration change.
2. Verified the postgresql.conf settings (listen_addresses and port).
3. Confirmed no other application is using port 5432 via netstat.
4. Created a specific *port-based* inbound rule in Windows Defender
Firewall to allow all TCP connections on port 5432.
5. Created a more robust *program-based* inbound rule in Windows
Defender Firewall for the postgres.exe executable (C:\Program
Files\PostgreSQL\17\bin\postgres.exe).
6. Restarted the PostgreSQL service after every configuration change.
7. Performed a full uninstall, manual folder deletion, reboot, and clean
reinstallation of PostgreSQL 17. (Note: The same issue was observed when
testing with PostgreSQL 16).
8. Considered and ruled out third-party antivirus as the user has none.

*Conclusion:* The evidence strongly suggests the issue is not with the
PostgreSQL configuration but with a low-level environmental factor on this
specific Windows machine (e.g., a hidden security policy, a third-party
security application that is not Windows Defender, or a corrupted Windows
networking stack) that is preventing the postgres.exe process from
successfully binding to a TCP socket.

*Given that the PostgreSQL configuration is correct and standard firewall
troubleshooting has been performed, the root cause appears to be an
environmental issue on my Windows machine that is blocking the postgres.exe
process from binding to its network port.*

*My question is: What other, less common Windows-level factors could cause
this specific behavior?*

*For example, could this be related to:*

- *Specific Group Policies (secpol.msc)?*
- *Permissions issues tied to the 'Network Service' account that
PostgreSQL runs under?*
- *Conflicts with specific VPN software, virtualization software (like
Hyper-V), or other low-level network drivers?*
- *A known bug with the Windows networking stack itself?*

*Any suggestions for deeper diagnostic steps or potential hidden conflicts
on Windows would be greatly appreciated."*

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: José António Gomes (#1)
Re: PostgreSQL 17 Service Running but Not Listening on Network Port on Windows

On Wed, Jun 18, 2025 at 1:37 PM José António Gomes <
jose.antonio.luanda@gmail.com> wrote:

Any suggestions for deeper diagnostic steps or potential hidden conflicts
on Windows would be greatly appreciated."

Try using port 15432

David J.

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: José António Gomes (#1)
Re: PostgreSQL 17 Service Running but Not Listening on Network Port on Windows

=?UTF-8?B?Sm9zw6kgQW50w7NuaW8gR29tZXM=?= <jose.antonio.luanda@gmail.com> writes:

*Subject: PostgreSQL 17 Service Running but Not Listening on Network Port
on Windows*

Did you examine the postmaster log? The first few lines should show
what ports it bound to. For example, on a Linux box I see

2025-06-14 12:48:07.536 EDT [12649] LOG: starting PostgreSQL 17.5 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-26), 64-bit
2025-06-14 12:48:07.536 EDT [12649] LOG: listening on IPv4 address "0.0.0.0", port 5432
2025-06-14 12:48:07.536 EDT [12649] LOG: listening on IPv6 address "::", port 5432
2025-06-14 12:48:07.536 EDT [12649] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
2025-06-14 12:48:07.543 EDT [12653] LOG: database system was shut down at 2025-06-14 12:21:00 EDT
2025-06-14 12:48:07.554 EDT [12649] LOG: database system is ready to accept connections

This won't immediately reveal the problem, I imagine, but it would
help decide where to look.

regards, tom lane