two statement_timeout race conditions

Started by Tomas Vondra14 days ago10 messageshackers
Jump to latest
#1Tomas Vondra
tomas@vondra.me

Hi,

While running a stress test on a patch I'm working on, I ran into two
annoying race conditions with statement_timeout. It's not a huge issue,
most people either don't have statement_timeout set at all, or there's
sufficient margin to not hit the timeout very often. I've since
mitigated that in my test script, but it was annoying and it took me a
while to figure out what's going to (and that it's not a bug in the new
code I was testing).

1) statement_timeout can kill the next command instead

Roughly what happens is that the command takes just about the timeout,
the timeout fires, but the statement does not check interrupts before it
ends, and we leave the cancel request as pending. Then we run the next
command (which could be as simple as "SET guc"), and that gets killed by
the timeout. That's exactly what I saw with statement_timeout = '60s',
SET statements getting aborted.

This happens because isable_statement_timeout() does nothing if
get_timeout_active() says the timeout is no longer active, which is the
case once it has fired. So the indicator stays set, and then is reported
as a statement timeout against whatever comes next (without being
executed at all).

I'm attaching a SQL reproducer for that (repro-exec.sql), leveraging the
fact that lpad() does not check interrupts even for very long values
(which we should probably fix, "repeat" already does that). And
CALL/FETCH don't either.

The attached 0001 fixes this race by doing pretty much the same thing as
ProcessInterrupts() for QueryCancelPending - checking both lock/timeout
indicators, and resetting the flag. With this the reproducer no longer
reproduces the unexpected interruptions.

2) statement timeout reported as "user request" cancellation

While looking at the code and trying to come up with reproducers for the
first issue, I ran into a second race, where we correctly cancel the
query due to a timeout, but report it happened due to a "user request".

It can happen if the timeout expires while parsing a long query string
(yes, that's not very common), because that does not check interrupts.
In exec_simple_query() we start the timer, do parsing etc., and then
call enable_statement_timeout() again, which does this:

if (!get_timeout_active(STATEMENT_TIMEOUT) &&
!get_timeout_indicator(STATEMENT_TIMEOUT, false))
enable_timeout_after(STATEMENT_TIMEOUT, StatementTimeout);

But get_timeout_active(() returns false if the timer already fired, so
the timer gets restarted, but leaves QueryCancelPending set. And so on
the next CHECK_FOR_INTERRUPTS() the query gets cancelled with the
misleading "canceling statement due to user request" reason.

I'm attaching a SQL reproducer for this too (repro-parse.sql), hitting
this. It's a bit artificial, I don't think I've seen this in practice
(even though some of the queries the stress test produces are long and
complex). 0002 fixes that by not restarting the timer that has fired
(which relies on the previous commit).

regards

--
Tomas Vondra

Attachments:

t258340_1
v1-0002-Don-t-restart-a-statement-timeout-that-has-alread.patchtext/x-patch; charset=UTF-8; name=v1-0002-Don-t-restart-a-statement-timeout-that-has-alread.patchDownload+6-3
v1-0001-Discard-pending-timeout-cancel-requests-at-end-of.patchtext/x-patch; charset=UTF-8; name=v1-0001-Discard-pending-timeout-cancel-requests-at-end-of.patchDownload+23-2
repro-parse.sqlapplication/sql; name=repro-parse.sqlDownload
repro-exec.sqlapplication/sql; name=repro-exec.sqlDownload
#2Chao Li
li.evan.chao@gmail.com
In reply to: Tomas Vondra (#1)
Re: two statement_timeout race conditions

On Nov 9, 2026, at 08:12, Tomas Vondra <tomas@vondra.me> wrote:

Hi,

While running a stress test on a patch I'm working on, I ran into two
annoying race conditions with statement_timeout. It's not a huge issue,
most people either don't have statement_timeout set at all, or there's
sufficient margin to not hit the timeout very often. I've since
mitigated that in my test script, but it was annoying and it took me a
while to figure out what's going to (and that it's not a bug in the new
code I was testing).

1) statement_timeout can kill the next command instead

Roughly what happens is that the command takes just about the timeout,
the timeout fires, but the statement does not check interrupts before it
ends, and we leave the cancel request as pending. Then we run the next
command (which could be as simple as "SET guc"), and that gets killed by
the timeout. That's exactly what I saw with statement_timeout = '60s',
SET statements getting aborted.

This happens because isable_statement_timeout() does nothing if
get_timeout_active() says the timeout is no longer active, which is the
case once it has fired. So the indicator stays set, and then is reported
as a statement timeout against whatever comes next (without being
executed at all).

I'm attaching a SQL reproducer for that (repro-exec.sql), leveraging the
fact that lpad() does not check interrupts even for very long values
(which we should probably fix, "repeat" already does that). And
CALL/FETCH don't either.

The attached 0001 fixes this race by doing pretty much the same thing as
ProcessInterrupts() for QueryCancelPending - checking both lock/timeout
indicators, and resetting the flag. With this the reproducer no longer
reproduces the unexpected interruptions.

2) statement timeout reported as "user request" cancellation

While looking at the code and trying to come up with reproducers for the
first issue, I ran into a second race, where we correctly cancel the
query due to a timeout, but report it happened due to a "user request".

It can happen if the timeout expires while parsing a long query string
(yes, that's not very common), because that does not check interrupts.
In exec_simple_query() we start the timer, do parsing etc., and then
call enable_statement_timeout() again, which does this:

if (!get_timeout_active(STATEMENT_TIMEOUT) &&
!get_timeout_indicator(STATEMENT_TIMEOUT, false))
enable_timeout_after(STATEMENT_TIMEOUT, StatementTimeout);

But get_timeout_active(() returns false if the timer already fired, so
the timer gets restarted, but leaves QueryCancelPending set. And so on
the next CHECK_FOR_INTERRUPTS() the query gets cancelled with the
misleading "canceling statement due to user request" reason.

I'm attaching a SQL reproducer for this too (repro-parse.sql), hitting
this. It's a bit artificial, I don't think I've seen this in practice
(even though some of the queries the stress test produces are long and
complex). 0002 fixes that by not restarting the timer that has fired
(which relies on the previous commit).

regards

--
Tomas Vondra
<v1-0002-Don-t-restart-a-statement-timeout-that-has-alread.patch><v1-0001-Discard-pending-timeout-cancel-requests-at-end-of.patch><repro-parse.sql><repro-exec.sql>

Using your repro scripts, I can reproduce the race on my MacBook too, and I have confirmed that the fix resolves it.

I have a question. This patch seems to add a restriction to disable_statement_timeout(): because it now also discards pending LOCK_TIMEOUT and STATEMENT_TIMEOUT cancellations, it should only be called at a command-completion boundary. Currently, there are only three callers, and they meet this restriction. However, I’m not sure whether a future caller might call this function midway through a statement. From this perspective, I think a new name, for example, finish_statement_timeout(), might avoid confusion.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

#3Ayush Tiwari
ayushtiwari.slg01@gmail.com
In reply to: Tomas Vondra (#1)
Re: two statement_timeout race conditions

Hi,

On Mon, 9 Nov 2026 at 05:42, Tomas Vondra <tomas@vondra.me> wrote:

Hi,

While running a stress test on a patch I'm working on, I ran into two
annoying race conditions with statement_timeout. It's not a huge issue,
most people either don't have statement_timeout set at all, or there's
sufficient margin to not hit the timeout very often. I've since
mitigated that in my test script, but it was annoying and it took me a
while to figure out what's going to (and that it's not a bug in the new
code I was testing).

1) statement_timeout can kill the next command instead

Roughly what happens is that the command takes just about the timeout,
the timeout fires, but the statement does not check interrupts before it
ends, and we leave the cancel request as pending. Then we run the next
command (which could be as simple as "SET guc"), and that gets killed by
the timeout. That's exactly what I saw with statement_timeout = '60s',
SET statements getting aborted.

This happens because isable_statement_timeout() does nothing if
get_timeout_active() says the timeout is no longer active, which is the
case once it has fired. So the indicator stays set, and then is reported
as a statement timeout against whatever comes next (without being
executed at all).

I'm attaching a SQL reproducer for that (repro-exec.sql), leveraging the
fact that lpad() does not check interrupts even for very long values
(which we should probably fix, "repeat" already does that). And
CALL/FETCH don't either.

The attached 0001 fixes this race by doing pretty much the same thing as
ProcessInterrupts() for QueryCancelPending - checking both lock/timeout
indicators, and resetting the flag. With this the reproducer no longer
reproduces the unexpected interruptions.

Thanks for the patches, the repros made this easy to check.

2) statement timeout reported as "user request" cancellation

While looking at the code and trying to come up with reproducers for the
first issue, I ran into a second race, where we correctly cancel the
query due to a timeout, but report it happened due to a "user request".

It can happen if the timeout expires while parsing a long query string
(yes, that's not very common), because that does not check interrupts.
In exec_simple_query() we start the timer, do parsing etc., and then
call enable_statement_timeout() again, which does this:

if (!get_timeout_active(STATEMENT_TIMEOUT) &&
!get_timeout_indicator(STATEMENT_TIMEOUT, false))
enable_timeout_after(STATEMENT_TIMEOUT, StatementTimeout);

But get_timeout_active(() returns false if the timer already fired, so
the timer gets restarted, but leaves QueryCancelPending set. And so on
the next CHECK_FOR_INTERRUPTS() the query gets cancelled with the
misleading "canceling statement due to user request" reason.

I'm attaching a SQL reproducer for this too (repro-parse.sql), hitting
this. It's a bit artificial, I don't think I've seen this in practice
(even though some of the queries the stress test produces are long and
complex). 0002 fixes that by not restarting the timer that has fired
(which relies on the previous commit).

I was poking at this a bit, and I think it would be good to also check
QueryCancelPending there, i.e. only skip the restart while the cancel
is actually still pending:

if (!get_timeout_active(STATEMENT_TIMEOUT) &&
!(QueryCancelPending &&
get_timeout_indicator(STATEMENT_TIMEOUT, false)))
enable_timeout_after(STATEMENT_TIMEOUT, StatementTimeout);

Otherwise, if the cancel already got handled somewhere else (e.g. in the
sync rep wait), the indicator stays set and the next query can end up
running without any statement timeout.

It's a pretty narrow case, but seems worth fixing.

Rest looks good to me.

Regards,
Ayush

#4surya poondla
suryapoondla4@gmail.com
In reply to: Tomas Vondra (#1)
Re: two statement_timeout race conditions

Hi Tomas,

Thank you for reporting the issue and the patch.
I tested v1 on master (0dbe240dc0e). Both reproducers show the problem on
master and are fixed with 0001+0002, make check and the isolation suite
pass.

+1 to Ayush's suggestion of also checking QueryCancelPending in
enable_statement_timeout(). 0001 resets the indicator in most cases, but an
Execute that ends in PortalSuspended doesn't go through
disable_statement_timeout(), so a stale indicator could still reach the
next statement in the same pipeline (before Sync). For example, a CALL with
an INOUT parameter that does COMMIT, executed with max_rows = 1, where
statement_timeout fires during the sync rep wait (which clears
QueryCancelPending but not the indicator). It's a narrow case, and the
extra check seems cheap.

Regards,
Surya Poondla

#5Tomas Vondra
tomas@vondra.me
In reply to: Ayush Tiwari (#3)
Re: two statement_timeout race conditions

On 11/9/26 09:49, Ayush Tiwari wrote:

...

2) statement timeout reported as "user request" cancellation

While looking at the code and trying to come up with reproducers for the
first issue, I ran into a second race, where we correctly cancel the
query due to a timeout, but report it happened due to a "user request".

It can happen if the timeout expires while parsing a long query string
(yes, that's not very common), because that does not check interrupts.
In exec_simple_query() we start the timer, do parsing etc., and then
call enable_statement_timeout() again, which does this:

if (!get_timeout_active(STATEMENT_TIMEOUT) &&
!get_timeout_indicator(STATEMENT_TIMEOUT, false))
enable_timeout_after(STATEMENT_TIMEOUT, StatementTimeout);

But get_timeout_active(() returns false if the timer already fired, so
the timer gets restarted, but leaves QueryCancelPending set. And so on
the next CHECK_FOR_INTERRUPTS() the query gets cancelled with the
misleading "canceling statement due to user request" reason.

I'm attaching a SQL reproducer for this too (repro-parse.sql), hitting
this. It's a bit artificial, I don't think I've seen this in practice
(even though some of the queries the stress test produces are long and
complex). 0002 fixes that by not restarting the timer that has fired
(which relies on the previous commit).

I was poking at this a bit, and I think it would be good to also check
QueryCancelPending there, i.e. only skip the restart while the cancel
is actually still pending:

if (!get_timeout_active(STATEMENT_TIMEOUT) &&
!(QueryCancelPending &&
get_timeout_indicator(STATEMENT_TIMEOUT, false)))
enable_timeout_after(STATEMENT_TIMEOUT, StatementTimeout);

Otherwise, if the cancel already got handled somewhere else (e.g. in the
sync rep wait), the indicator stays set and the next query can end up
running without any statement timeout.

It's a pretty narrow case, but seems worth fixing.

Yeah, thanks for noticing that. I agree this this can happen, and it
would prevent starting the statement timeout after that. But I'm not
sure this is the right fix, as it seems to contradict the comment before
enable_statement_timeout (and the contract for these functions).

The 0001 commit should probably spell out the behavior/contract change
more explicitly. Before the commit, enable_statement_timeout() would
start the timeout unless it's already active. With 0001 the timeout is
started only if it's neither active nor fired. I think adding the
QueryCancelPending check would make this less clear.

I was wondering if syncrep is the only place with this issue, and it
seem it is. The other places clearing QueryCancelPending seems safe:

* Autovacuum workers force statement_timeout and lock_timeout to 0, so
those timeouts are never started in that context.

* Error recovery in PostgresMain() and in the autovacuum launcher calls
disable_all_timeouts(false) first, which resets them.

* ProcessInterrupts() and disable_statement_timeout() reset both timeout
indicators themselves.

* ProcessInterrupts() and proc_exit_prepare() clear the flag right
before the process exits, so who cares if the timeouts run.

The non-exit cases are safe because they reset/disable the timeouts,
making the stale indicator impossible. Syncrep is the only case not
doing that. I think that's the root cause, and it'd be better to fix
that by doing roughly:

if (QueryCancelPending)
{
QueryCancelPending = false;
(void) get_timeout_indicator(LOCK_TIMEOUT, true);
(void) get_timeout_indicator(STATEMENT_TIMEOUT, true);
ereport(WARNING, ...);
}

Attached is v2 doing it this way.

BTW the earlier patches suggested I'm planning to backpatch this (to all
supported branches), but I've changed my mind and probably won't do
that. At least not initially. I've not seen a single report about these
issues, it's not worth the risk.

regards

--
Tomas Vondra

Attachments:

t258340_5
v2-0002-Don-t-restart-a-statement-timeout-that-has-alread.patchtext/x-patch; charset=UTF-8; name=v2-0002-Don-t-restart-a-statement-timeout-that-has-alread.patchDownload+24-9
v2-0001-Discard-pending-timeout-cancel-requests-at-end-of.patchtext/x-patch; charset=UTF-8; name=v2-0001-Discard-pending-timeout-cancel-requests-at-end-of.patchDownload+23-2
#6Ayush Tiwari
ayushtiwari.slg01@gmail.com
In reply to: Tomas Vondra (#5)
Re: two statement_timeout race conditions

Hi,

On Sat, 14 Nov 2026 at 01:14, Tomas Vondra <tomas@vondra.me> wrote:

On 11/9/26 09:49, Ayush Tiwari wrote:

...

2) statement timeout reported as "user request" cancellation

While looking at the code and trying to come up with reproducers for the
first issue, I ran into a second race, where we correctly cancel the
query due to a timeout, but report it happened due to a "user request".

It can happen if the timeout expires while parsing a long query string
(yes, that's not very common), because that does not check interrupts.
In exec_simple_query() we start the timer, do parsing etc., and then
call enable_statement_timeout() again, which does this:

if (!get_timeout_active(STATEMENT_TIMEOUT) &&
!get_timeout_indicator(STATEMENT_TIMEOUT, false))
enable_timeout_after(STATEMENT_TIMEOUT, StatementTimeout);

But get_timeout_active(() returns false if the timer already fired, so
the timer gets restarted, but leaves QueryCancelPending set. And so on
the next CHECK_FOR_INTERRUPTS() the query gets cancelled with the
misleading "canceling statement due to user request" reason.

I'm attaching a SQL reproducer for this too (repro-parse.sql), hitting
this. It's a bit artificial, I don't think I've seen this in practice
(even though some of the queries the stress test produces are long and
complex). 0002 fixes that by not restarting the timer that has fired
(which relies on the previous commit).

I was poking at this a bit, and I think it would be good to also check
QueryCancelPending there, i.e. only skip the restart while the cancel
is actually still pending:

if (!get_timeout_active(STATEMENT_TIMEOUT) &&
!(QueryCancelPending &&
get_timeout_indicator(STATEMENT_TIMEOUT, false)))
enable_timeout_after(STATEMENT_TIMEOUT, StatementTimeout);

Otherwise, if the cancel already got handled somewhere else (e.g. in the
sync rep wait), the indicator stays set and the next query can end up
running without any statement timeout.

It's a pretty narrow case, but seems worth fixing.

Yeah, thanks for noticing that. I agree this this can happen, and it
would prevent starting the statement timeout after that. But I'm not
sure this is the right fix, as it seems to contradict the comment before
enable_statement_timeout (and the contract for these functions).

The 0001 commit should probably spell out the behavior/contract change
more explicitly. Before the commit, enable_statement_timeout() would
start the timeout unless it's already active. With 0001 the timeout is
started only if it's neither active nor fired. I think adding the
QueryCancelPending check would make this less clear.

I was wondering if syncrep is the only place with this issue, and it
seem it is. The other places clearing QueryCancelPending seems safe:

* Autovacuum workers force statement_timeout and lock_timeout to 0, so
those timeouts are never started in that context.

* Error recovery in PostgresMain() and in the autovacuum launcher calls
disable_all_timeouts(false) first, which resets them.

* ProcessInterrupts() and disable_statement_timeout() reset both timeout
indicators themselves.

* ProcessInterrupts() and proc_exit_prepare() clear the flag right
before the process exits, so who cares if the timeouts run.

The non-exit cases are safe because they reset/disable the timeouts,
making the stale indicator impossible. Syncrep is the only case not
doing that. I think that's the root cause, and it'd be better to fix
that by doing roughly:

if (QueryCancelPending)
{
QueryCancelPending = false;
(void) get_timeout_indicator(LOCK_TIMEOUT, true);
(void) get_timeout_indicator(STATEMENT_TIMEOUT, true);
ereport(WARNING, ...);
}

Attached is v2 doing it this way.

Yup, I went through the QueryCancelPending = false sites too, and syncrep
is the only one that neither resets the indicators nor exits. Fixing it
there is better than my check, fine with me. Thanks for the update!

BTW the earlier patches suggested I'm planning to backpatch this (to all
supported branches), but I've changed my mind and probably won't do
that. At least not initially. I've not seen a single report about these
issues, it's not worth the risk.

Makes sense.

Regards,
Ayush

#7Zsolt Parragi
zsolt.parragi@percona.com
In reply to: Ayush Tiwari (#6)
Re: two statement_timeout race conditions

Hello!

I tested this patch a bit, and claude pointed out another corner case: lock_timeout firing during COMMIT still leaks into the next command

finish_xact_command() runs the new discard before the commit:

/* cancel active statement timeout after each command */
disable_statement_timeout();

if (xact_started)
{
CommitTransactionCommand();

But commit can still wait for a heavyweight lock: PreCommit_Notify() takes the "database 0" lock, and there's no CHECK_FOR_INTERRUPTS() after the grant until the end of the commit. If lock_timeout fires just as that lock is granted, the COMMIT succeeds and the next command fails. Tiny window, so it needs an additional sleep to be reliably reproducible.

The same happens with an extended protocol autocommit SELECT pg_notify(...) (committed at Sync) followed by any statement, and with a pipelined statement after COMMIT.

This seems to fix it:

@@ finish_xact_command
CommitTransactionCommand();

+		/*
+		 * Commit itself can wait for a heavyweight lock (PreCommit_Notify),
+		 * after disable_statement_timeout() above already ran.  Discard a
+		 * lock timeout request left behind by a grant at timeout time.
+		 */
+		if (get_timeout_indicator(LOCK_TIMEOUT, true))
+			QueryCancelPending = false;

And in 0002:

 			QueryCancelPending = false;
+			(void) get_timeout_indicator(LOCK_TIMEOUT, true);
+			(void) get_timeout_indicator(STATEMENT_TIMEOUT, true);
 			ereport(WARNING,
 					(errmsg("canceling wait for synchronous replication due to user request"),

Won't this result in the same incorrect message pattern the patch tries to repair elsewhere?

#8Tomas Vondra
tomas@vondra.me
In reply to: Zsolt Parragi (#7)
Re: two statement_timeout race conditions

On 11/15/26 00:06, Zsolt Parragi wrote:

Hello!

I tested this patch a bit, and claude pointed out another corner case:
lock_timeout firing during COMMIT still leaks into the next command

finish_xact_command() runs the new discard before the commit:

/* cancel active statement timeout after each command */
disable_statement_timeout();

if (xact_started)
{
CommitTransactionCommand();

But commit can still wait for a heavyweight lock: PreCommit_Notify()
takes the "database 0" lock, and there's no CHECK_FOR_INTERRUPTS()
after the grant until the end of the commit. If lock_timeout fires
just as that lock is granted, the COMMIT succeeds and the next command
fails. Tiny window, so it needs an additional sleep to be reliably
reproducible.

The same happens with an extended protocol autocommit SELECT
pg_notify(...) (committed at Sync) followed by any statement, and with
a pipelined statement after COMMIT.

This seems to fix it:

@@ finish_xact_command
CommitTransactionCommand();

+		/*
+		 * Commit itself can wait for a heavyweight lock (PreCommit_Notify),
+		 * after disable_statement_timeout() above already ran.  Discard a
+		 * lock timeout request left behind by a grant at timeout time.
+		 */
+		if (get_timeout_indicator(LOCK_TIMEOUT, true))
+			QueryCancelPending = false;

Hmmm. I guess that could happen ...

And in 0002:

QueryCancelPending = false;
+			(void) get_timeout_indicator(LOCK_TIMEOUT, true);
+			(void) get_timeout_indicator(STATEMENT_TIMEOUT, true);
ereport(WARNING,
(errmsg("canceling wait for synchronous replication due to user request"),

Won't this result in the same incorrect message pattern the patch
tries to repair elsewhere?

You mean the "statement timeout" reported as "user request"? I believe
that happens because the timeout indicator is cleared, while the
QueryCancelPending is left set. But here we're resetting both, so I
don't see how could it have the same effect.

What's the scenario that'd lead to the same issue?

regards

--
Tomas Vondra

#9Zsolt Parragi
zsolt.parragi@percona.com
In reply to: Tomas Vondra (#8)
Re: two statement_timeout race conditions

On Sat, 14 Nov 2026, Tomas Vondra <tomas.vondra@2ndquadrant.com> wrote:

You mean the "statement timeout" reported as "user request"? I believe
that happens because the timeout indicator is cleared, while the
QueryCancelPending is left set. But here we're resetting both, so I
don't see how could it have the same effect.

What's the scenario that'd lead to the same issue?

With synchronous_standby_names=nobody and max_prepared_transactions=5:

SET synchronous_commit = local;
CREATE TABLE s (x int);
CREATE PROCEDURE p_commit() LANGUAGE plpgsql AS $$
BEGIN
INSERT INTO s VALUES (1);
COMMIT;
RAISE NOTICE 'after commit, indicator consumed by syncrep';
END $$;

SET synchronous_commit = on;
SET statement_timeout = '200ms';
CALL p_commit();
-- SET
-- SET
-- WARNING: canceling wait for synchronous replication due to user request
-- DETAIL: The transaction has already committed locally, but might not have been replicated to the standby.
-- NOTICE: after commit, indicator consumed by syncrep
-- CALL

And also:

SET statement_timeout = 0;
SET synchronous_commit = local;
BEGIN; INSERT INTO s VALUES (2); PREPARE TRANSACTION 'g1';
SET synchronous_commit = on;
SET statement_timeout = '200ms';
COMMIT PREPARED 'g1';
-- same due to user request message

#10shihao zhong
zhong950419@gmail.com
In reply to: Zsolt Parragi (#9)
Re: two statement_timeout race conditions

Hi Tomas,

Thanks for working on this. Both races already have a thread.

The second is Jelte's CF entry [1]https://commitfest.postgresql.org/patch/5070/

The first is what I posted in September [2]/messages/by-id/CAGRkXqQ7d+B+XDCNR0oUmG55EJ421HPj3saWONU2Uc0VKqARWg@mail.gmail.com, where a parallel hash join
hits it. Given we already start review your patch, so I am happy to drop my
0002,
but the 0001 is not covered here.

[1]: https://commitfest.postgresql.org/patch/5070/
[2]: /messages/by-id/CAGRkXqQ7d+B+XDCNR0oUmG55EJ421HPj3saWONU2Uc0VKqARWg@mail.gmail.com
/messages/by-id/CAGRkXqQ7d+B+XDCNR0oUmG55EJ421HPj3saWONU2Uc0VKqARWg@mail.gmail.com

Thanks,
Shihao