From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Move libpq's write_failed mechanism down to pqsecure_raw_write() |
Date: | 2022-02-12 19:00:20 |
Message-ID: | E1nIxd6-0007XV-84@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Move libpq's write_failed mechanism down to pqsecure_raw_write().
Commit 1f39a1c06 implemented write-failure postponement in pqSendSome,
which is above SSL/GSS processing. However, we've now seen failures
indicating that (some versions of?) OpenSSL have a tendency to report
write failures prematurely too. Hence, move the primary responsibility
for postponing write failures down to pqsecure_raw_write(), below
SSL/GSS processing. pqSendSome now sets write_failed only in corner
cases where we'd lost the connection already.
A side-effect of this change is that errors detected in the SSL/GSS
layer itself will be reported immediately (as if they were read
errors) rather than being postponed like write errors. That's
reverting an effect of 1f39a1c06, and I think it's fine: if there's
not a socket-level error, it's hard to be sure whether an OpenSSL
error ought to be considered a read or write failure anyway.
Another important point is that write-failure postponement is now
effective during connection setup. OpenSSL's misbehavior of this
sort occurs during SSL_connect(), so that's a change we want.
Per bug #17391 from Nazir Bilal Yavuz. Possibly this should be
back-patched, but I think it prudent to let it age awhile in HEAD
first.
Discussion: https://postgr.es/m/17391-304f81bcf724b58b@postgresql.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/faa189c932d51945b2285e277128b0f26b96afdd
Modified Files
--------------
src/interfaces/libpq/fe-misc.c | 47 ++++++++++-------------
src/interfaces/libpq/fe-secure.c | 81 ++++++++++++++++++++++++++++++++++------
2 files changed, 90 insertions(+), 38 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2022-02-12 20:10:46 | Re: pgsql: Add TAP test to automate the equivalent of check_guc |
Previous Message | Tom Lane | 2022-02-12 18:23:35 | pgsql: Fix thinko in PQisBusy(). |