pgsql: Move libpq's write_failed mechanism down to pqsecure_raw_write()

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Move libpq's write_failed mechanism down to pqsecure_raw_write()
Дата
Msg-id E1nIxd6-0007XV-84@gemulon.postgresql.org
обсуждение исходный текст
Список 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(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix thinko in PQisBusy().
Следующее
От: Andres Freund
Дата:
Сообщение: Re: pgsql: Add decoding of sequences to test_decoding