Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit592b615

Browse files
committed
Fix incorrect timeout handling during initial authentication transaction.
The statement start timestamp was not set before initiating the transactionthat is used to look up client authentication information in pg_authid.In consequence, enable_sig_alarm computed a wrong value (far in the past)for statement_fin_time. That didn't have any immediate effect, because thetimeout alarm was set without reference to statement_fin_time; but if wesubsequently blocked on a lock for a short time, CheckStatementTimeoutwould consult the bogus value when we cancelled the lock timeout wait,and then conclude we'd timed out, leading to immediate failure of theconnection attempt. Thus an innocent "vacuum full pg_authid" would causefailures of concurrent connection attempts. Noted while testing other,more serious consequences of vacuum full on system catalogs.We should set the statement timestamp before StartTransactionCommand(),so that the transaction start timestamp is also valid. I'm not sure ifthere are any non-cosmetic effects of it not being valid, but the xacttimestamp is at least sent to the statistics machinery.Back-patch to 9.0. Before that, the client authentication timeout was doneoutside any transaction and did not depend on this state to be valid.
1 parent6d7bd5d commit592b615

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

‎src/backend/utils/init/postinit.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,8 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username,
571571
*/
572572
if (!bootstrap)
573573
{
574+
/* statement_timestamp must be set for timeouts to work correctly */
575+
SetCurrentStatementStartTimestamp();
574576
StartTransactionCommand();
575577
(void)GetTransactionSnapshot();
576578
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp