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

Commit0da46d7

Browse files
committed
Prevent idle in transaction session timeout from sometimes being ignored.
The previous coding in ProcessInterrupts() could lead toidle_in_transaction_session_timeout being ignored, whenstatement_timeout occurred earlier.The problem was that ProcessInterrupts() would return beforeprocessing the transaction timeout if QueryCancelPending was set whileQueryCancelHoldoffCount != 0 - which is the case when reading newcommands from the client. Ergo when the idle transaction timeout wouldhit.Fix that by removing the early return. Alternatively the transactiontimeout code could have been moved up, but that early return seemslike an issue that could hit other cases too.Author: Lukas FittlBug: #14821Discussion:https://www.postgresql.org/message-id/20170921010956.17345.61461%40wrigleys.postgresql.orghttps://www.postgresql.org/message-id/CAP53PkxQnv3OWJpyNPGJYT62uY=n1=2CF_Lpc6gVOFnc0-gazw@mail.gmail.comBackpatch: 9.6-, where idle_in_transaction_session_timeout was introduced.
1 parent19989d8 commit0da46d7

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

‎src/backend/tcop/postgres.c

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2903,26 +2903,24 @@ ProcessInterrupts(void)
29032903
" database and repeat your command.")));
29042904
}
29052905

2906-
if (QueryCancelPending)
2906+
/*
2907+
* Don't allow query cancel interrupts while reading input from the
2908+
* client, because we might lose sync in the FE/BE protocol. (Die
2909+
* interrupts are OK, because we won't read any further messages from
2910+
* the client in that case.)
2911+
*/
2912+
if (QueryCancelPending&&QueryCancelHoldoffCount!=0)
29072913
{
2908-
boollock_timeout_occurred;
2909-
boolstmt_timeout_occurred;
2910-
29112914
/*
2912-
* Don't allow query cancel interrupts while reading input from the
2913-
* client, because we might lose sync in the FE/BE protocol. (Die
2914-
* interrupts are OK, because we won't read any further messages from
2915-
* the client in that case.)
2915+
* Re-arm InterruptPending so that we process the cancel request
2916+
* as soon as we're done reading the message.
29162917
*/
2917-
if (QueryCancelHoldoffCount!=0)
2918-
{
2919-
/*
2920-
* Re-arm InterruptPending so that we process the cancel request
2921-
* as soon as we're done reading the message.
2922-
*/
2923-
InterruptPending= true;
2924-
return;
2925-
}
2918+
InterruptPending= true;
2919+
}
2920+
elseif (QueryCancelPending)
2921+
{
2922+
boollock_timeout_occurred;
2923+
boolstmt_timeout_occurred;
29262924

29272925
QueryCancelPending= false;
29282926

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp