> For now I replay for the above. Oh sorry, I was wrong about the condition.
> The error occurred under following condition.
> - port = 32768
> - proxy_port = 6543
> - $ psql postgres -p 6543
>
> $ bin/pg_ctl start -D data
> waiting for server to start....
> LOG: starting PostgreSQL 13devel on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28),
64-bit
> LOG: listening on IPv6 address "::1", port 6543
> LOG: listening on IPv4 address "127.0.0.1", port 6543
> LOG: listening on IPv6 address "::1", port 32768
> LOG: listening on IPv4 address "127.0.0.1", port 32768
> LOG: listening on Unix socket "/tmp/.s.PGSQL.6543"
> LOG: listening on Unix socket "/tmp/.s.PGSQL.32768"
> LOG: Start proxy process 25374
> LOG: Start proxy process 25375
> LOG: database system was shut down at 2019-11-12 16:49:20 JST
> LOG: database system is ready to accept connections
>
> server started
> [postgres@vm-7kfq-coreban connection-pooling]$ psql -p 6543
> LOG: Message size 84
> WARNING: could not setup local connect to server
> DETAIL: invalid port number: "-32768"
> LOG: Handshake response will be sent to the client later when backed is assigned
> psql: error: could not connect to server: invalid port number: "-32768"
>
> By the way, the patch has some small conflicts against master.
Thank you very much for reporting the problem.
It was caused by using pg_itoa for string representation of port (I
could not imagine that unlike standard itoa it accepts int16 parameter
instead of int).
Attached please find rebased patch with this bug fixed.
--
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company