Re: backtrace_on_internal_error
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Peter Eisentraut <peter@eisentraut.org>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2023-12-09T17:41:30Z
Lists: pgsql-hackers
Attachments
- v2-0001-handle-openssl-returning-errno-zero.patch (text/x-diff) patch v2-0001
- v2-0002-handle-zero-errno-generally.patch (text/x-diff) patch v2-0002
I wrote: > Andres Freund <andres@anarazel.de> writes: >> I was wondering about that too. But if we do so, why not also do it for >> writes? > Writes don't act that way, do they? EOF on a pipe gives you an error, > not silently reporting that zero bytes were written and leaving you > to retry indefinitely. On further reflection I realized that you're right so far as the SSL code path goes, because SSL_write() can involve physical reads as well as writes, so at least in principle it's possible that we'd see EOF reported this way from that function. Also, the libpq side does need work of the same sort, leading to the v2-0001 patch attached. I also realized that we have more or less the same problem at the caller level, allowing a similar failure for non-SSL connections. So I'm also proposing 0002 attached. Your results from aggregated logs didn't show "could not receive data from client: Success" as a common case, but since we weren't bothering to zero errno beforehand, it's likely that such failures would show up with very random errnos. I took a quick look at the GSSAPI code path too, but it seems not to add any new assumptions of this sort. regards, tom lane
Commits
-
Add GUC backtrace_on_internal_error
- a740b213d4b4 17.0 landed
-
Fix variable name and comment
- 541e8f14a185 17.0 landed
-
Be more wary about OpenSSL not setting errno on error.
- ebbd499d4b55 16.2 landed
- 87b46ad90491 13.14 landed
- 551d4b28e445 15.6 landed
- 271d24f31ddd 12.18 landed
- 0a5c46a7a488 17.0 landed
- 07ce2432682d 14.11 landed