]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Avoid lockup of a parallel worker when reporting a long error message.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 3 Sep 2020 20:52:09 +0000 (16:52 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 3 Sep 2020 20:52:09 +0000 (16:52 -0400)
commit526df0a236df7d6d12ea91e9538af7efc5896d25
tree2e9f8e769657d8c5d3103bd1cda8d94fa29cab69
parent70ccff88d910f57e427331afcbd6322ff7c80d18
Avoid lockup of a parallel worker when reporting a long error message.

Because sigsetjmp() will restore the initial state with signals blocked,
the code path in bgworker.c for reporting an error and exiting would
execute that way.  Usually this is fairly harmless; but if a parallel
worker had an error message exceeding the shared-memory communication
buffer size (16K) it would lock up, because it would wait for a
resume-sending signal from its parallel leader which it would never
detect.

To fix, just unblock signals at the appropriate point.

This can be shown to fail back to 9.6.  The lack of parallel query
infrastructure makes it difficult to provide a simple test case for
9.5; but I'm pretty sure the issue exists in some form there as well,
so apply the code change there too.

Vignesh C, reviewed by Bharath Rupireddy, Robert Haas, and myself

Discussion: https://postgr.es/m/CALDaNm1d1hHPZUg3xU4XjtWBOLCrA+-2cJcLpw-cePZ=GgDVfA@mail.gmail.com
src/backend/postmaster/bgworker.c
src/test/regress/expected/select_parallel.out
src/test/regress/sql/select_parallel.sql