From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jānis Pūris <janis@puris.lv>
Cc: pgsql-general@postgresql.org
Subject: Re: TCP Resets when closing connection opened via SSL
Date: Fri, 26 Apr 2019 10:17:04 -0400
Message-ID: <31611.1556288224@sss.pgh.pa.us> (raw)
In-Reply-To: <695f797f-b02b-492a-94d3-0d5b4ab7c0a2@Spark>
References: <95b05f8d-990a-4f15-906f-24a011fc00ed@Spark>
<695f797f-b02b-492a-94d3-0d5b4ab7c0a2@Spark>
=?utf-8?Q?J=C4=81nis_P=C5=ABris?= <janis@puris.lv> writes:
> I'm trying to do a simple health check for keepalived and other services via a python script and psycopg2 library. All seems to be all right, until I close the connection, at which point a packet with TCP reset is produced.
Hm. It's fairly obvious from the postmaster log that the client side
is not bothering to close the transaction it started:
> 2019-04-23 16:27:45.306 CEST process=15615 c=BEGIN t=0 s=5cbf20e1.3cff monitoring@127.0.0.1:postgres app=[unknown] LOG: duration: 0.095 ms
> 2019-04-23 16:27:45.306 CEST process=15615 c=SELECT t=0 s=5cbf20e1.3cff monitoring@127.0.0.1:postgres app=[unknown] LOG: duration: 0.234 ms
> 2019-04-23 16:27:45.306 CEST process=15615 c=idle in transaction t=0 s=5cbf20e1.3cff monitoring@127.0.0.1:postgres app=[unknown] LOG: disconnection: session time: 0:00:00.006 user=monitoring database=postgres host=127.0.0.1 port=40797
There's no COMMIT or ROLLBACK to go with the BEGIN, and that's reflected
in the fact that the disconnection message shows c=idle in transaction.
Now, I doubt that would have any impact on the TCP-level session behavior,
but it suggests that maybe the client isn't bothering to close the session
cleanly either. The RST rather than FIN would then likely be caused by
SSL having to do an unclean shutdown.
regards, tom lane
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-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, janis@puris.lv
Subject: Re: TCP Resets when closing connection opened via SSL
In-Reply-To: <31611.1556288224@sss.pgh.pa.us>
References: <95b05f8d-990a-4f15-906f-24a011fc00ed@Spark> <695f797f-b02b-492a-94d3-0d5b4ab7c0a2@Spark> <31611.1556288224@sss.pgh.pa.us>
* 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