BUG #15234: Connection refused (0x0000274D/10061) - Service will notrun? - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #15234: Connection refused (0x0000274D/10061) - Service will notrun?
Date
Msg-id 152843289783.22458.2689940097981740344@wrigleys.postgresql.org
Whole thread Raw
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      15234
Logged by:          LorenAmelang
Email address:      loren@pacific.net
PostgreSQL version: 10.4
Operating system:   Win 10 Creators
Description:

This may be several bugs, or a documentation deficiency, or my horrible
luck...  RiverGIS is a QGIS plugin which needs a PostGIS database. All
installed new in the last two days. 

1. First install failed at VCRedist:
-----
Installation Directory: C:\Program Files\PostgreSQL\10
Server Installation Directory: C:\Program Files\PostgreSQL\10
Data Directory: C:\Users\loren\Giant Files\Postgre
Database Port: 5432
Database Superuser: postgres
Operating System Account: NT AUTHORITY\NetworkService
Database Service: postgresql-x64-10
Command Line Tools Installation Directory: C:\Program Files\PostgreSQL\10
pgAdmin4 Installation Directory: C:\Program Files\PostgreSQL\10\pgAdmin 4
Stack Builder Installation Directory: C:\Program Files\PostgreSQL\10

Error:
Failed to load SQL modules into the database cluster.

Script stderr:
 Program ended with an error exit code

Error running
C:\Users\loren\AppData\Local\Temp\postgresql_installer_aee8e5a76f\vcredist_x86.exe
/passive /norestart: Program ended with an error exit code
Executing
C:\Users\loren\AppData\Local\Temp\postgresql_installer_aee8e5a76f\vcredist_x64.exe
/passive /norestart
Script exit code: 3010

Reboot Required???

dd_vcredist_x86_20180607142051.log:
---
[27EC:35BC][2018-06-07T14:20:52]i301: Applying execute package:
vcRuntimeMinimum_x86, action: Install, path: C:\ProgramData\Package
Cache\{E30D8B21-D82D-3211-82CC-0F0A5D1495E8}v12.0.40660\packages\vcRuntimeMinimum_x86\vc_runtimeMinimum_x86.msi,
arguments: ' MSIFASTINSTALL="7" NOVSUI="1"'
[07BC:0FB4][2018-06-07T14:21:35]i319: Applied execute package:
vcRuntimeMinimum_x86, result: 0x0, restart: Required
---

dd_vcredist_x86_20180607142051_000_vcRuntimeMinimum_x86.log
---
MSI (s) (AC:FC) [14:21:35:341]: Product: Microsoft Visual C++ 2013 x86
Minimum Runtime - 12.0.40660. Restart required. The installation or update
for the product required a restart for all changes to take effect.  The
restart was deferred to a later time.

MSI (s) (AC:FC) [14:21:35:351]: Deferring clean up of packages/files, if any
exist
MSI (s) (AC:FC) [14:21:35:351]: MainEngineThread is returning 3010
---

There is no user warning of that, and no way for the user to restart before
later parts of the install fail. 
-----


2. I uninstalled, restarted, VCRedist remained, second install did not hit
that error. 


3. After restart, In Services -> postgresql-x64-10 - PostgreSQL Server 10:
"C:\Program Files\PostgreSQL\10\bin\pg_ctl.exe" runservice -N
"postgresql-x64-10" -D "C:\Users\loren\Giant Files\Postgre" -w
--> Service started, stopped automatically "unless in use..." 

No program is able to access Postgre...
---
C:\Program Files\PostgreSQL\10\bin>psql
psql: could not connect to server: Connection refused (0x0000274D/10061)
        Is the server running on host "localhost" (::1) and accepting
        TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
        Is the server running on host "localhost" (127.0.0.1) and
accepting
        TCP/IP connections on port 5432?
---


4. Another clean re-install...  With the PostGIS plugin this time. PostGIS
Spatial Database creation failed:

set PGPASSWORD=Ridgeview
set PGPORT=5432
"C:\Program Files\PostgreSQL\10\bin\createdb.exe" -U postgres -h localhost
postgis_24_sample 2>
"C:\Users\loren\AppData\Local\Temp\postgis_installer\create_spatial_db_error.txt"
if not %ERRORLEVEL%==0 exit %ERRORLEVEL%
...

C:\Users\loren\AppData\Local\Temp\postgis_installer
createdb: could not connect to database template1: could not connect to
server: Connection refused (0x0000274D/10061)
    Is the server running on host "localhost" (::1) and accepting
    TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?


5. I saw someone on the web saying the data directory can't have spaces.
Used the procedure in 
https://wiki.postgresql.org/wiki/Change_the_default_PGDATA_directory_on_Windows

Was:
"C:\Program Files\PostgreSQL\10\bin\pg_ctl.exe" runservice -N
"postgresql-x64-10" -D "C:\Users\loren\Giant Files\Postgre" -w

After I edited it, anything that length would disappear from regedit when I
tried to save it! 

I shortened the data path, and moved the "-w" to the "runservice" part of
the string like your example:

"C:\Program Files\PostgreSQL\10\bin\pg_ctl.exe" runservice -w -N
"postgresql-x64-10" -D "C:\Users\loren\Postgre"

Moved the actual data, new path is displayed properly in Services, still the
start-stop. 

And Still:
C:\Program Files\PostgreSQL\10\bin>psql
psql: could not connect to server: Connection refused (0x0000274D/10061)
        Is the server running on host "localhost" (::1) and accepting
        TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
        Is the server running on host "localhost" (127.0.0.1) and
accepting
        TCP/IP connections on port 5432?


6. Netstat doesn't ever see 5432 in use. Nmap won't scan localhost.
Wireshark doesn't see local traffic. Is your psql definitive? Is there some
other way to observe this? 


7. I see random "solutions" to this all over the web, but for versions 8 and
9. Most involve lots of re-installing, which I've already tried. Could I
please have some better suggestions what to try next? Glad to send more info
if it would help.


pgsql-bugs by date:

Previous
From: Thomas Munro
Date:
Subject: Re: BUG #15232: Query execution changes based on using 'explainanalyze' or not
Next
From: Amit Kapila
Date:
Subject: Re: BUG #15233: Error in estimation leads to very bad parralel planin simple 2 table join.