From: nunziotocci2000@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #14432: sslmode=allow causing authentication to time out
Date: Thu, 24 Nov 2016 17:55:30 +0000
Message-ID: <20161124175530.6530.75672@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 14432
Logged by: Annunziato Tocci
Email address: nunziotocci2000@gmail.com
PostgreSQL version: 9.6.1
Operating system: Fedora 24, 64-bit
Description:
I have a project that exposes a database with an API, and my test suites
have a problem
I send 100 login requests to PostgreSQL, and 2-3 of them come back 2 minutes
later saying "server closed the connection unexpectedly", and the server
logs say "canceling authentication due to timeout".
It is reproducible on Linux systems, but I haven't yet tested 9.6 on macOS
or Windows 10.
I tracked it down to sslmode=allow. The below script reproduces the
problem.
# this only says "too many clients"
$ ./test.sh disable
# this says "too many clients", interspersed with "server closed the
connection unexpectedly" errors, but the logs don't say "canceling
authentication due to timeout"
$ ./test.sh allow
I believe it is the same underlying problem, but there are slightly
different errors as described above.
Begin script:
```
#!/bin/sh
rm -rf data_test
initdb -D data_test -E UTF8 -U postgres
echo "unix_socket_directories='/tmp'" >> data_test/postgresql.conf
pg_ctl start -D data_test -o "-p 5431"
sleep 3
psql -U postgres -h 127.0.0.1 -p 5431 postgres -1c "ALTER ROLE postgres
PASSWORD 'password';"
pg_ctl stop -D data_test
cp data_test/pg_hba.conf data_test/pg_hba.bak
sed -e '/trust/s/32 trust/32 md5/g' <
data_test/pg_hba.bak > data_test/pg_hba.conf
echo "host all all 192.168.0.0/16 md5"
>> data_test/pg_hba.conf
pg_ctl start -D data_test -o "-p 5431 -N 1000"
sleep 3
pids=""
echo "127.0.0.1:5431:postgres:postgres:password" > ./pgpass
chmod 0600 ./pgpass
export PGPASSFILE="./pgpass"
for i in `seq 1 10000`; do
#echo "loop $i"
psql "host=127.0.0.1 dbname=postgres port=5431 sslmode="$1" user=postgres"
-1c "SELECT 'test', pg_sleep(5);" > /dev/null &
pids="$pids $!"
done
wait $pids
pg_ctl stop -D data_test
```
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: nunziotocci2000@gmail.com
Subject: Re: BUG #14432: sslmode=allow causing authentication to time out
In-Reply-To: <20161124175530.6530.75672@wrigleys.postgresql.org>
References: <20161124175530.6530.75672@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox