pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedcondition variable cleanup and subtransactions
3+ messages / 3 participants
[nested] [flat]
Commits from this thread:
2017-12-21 59d1e2b95a f3decdc94e Cancel CV sleep during subtransaction abort.
* condition variable cleanup and subtransactions
@ 2017-12-21 11:00 Andres Freund <andres@anarazel.de>
2017-12-21 11:46 ` Re: condition variable cleanup and subtransactions Thomas Munro <thomas.munro@enterprisedb.com>
0 siblings, 1 reply; 3+ messages in thread
From: Andres Freund @ 2017-12-21 11:00 UTC (permalink / raw)
To: pgsql-hackers@postgresql.org, pgsql-committers@postgresql.org, Thomas Munro <thomas.munro@enterprisedb.com>; Robert Haas <robertmhaas@gmail.com>
Hi,
On 2017-12-21 02:42:25 -0800, Andres Freund wrote:
> Trying to debug this I found another issue. I'd placed a sleep(10) in
> ExecParallelHashCloseBatchAccessors() and then ctrl-c'ed the server for
> some reason. Segfault time:
>
> #0 0x000055bfbac42539 in tas (lock=0x7fcd82ae14ac <error: Cannot access memory at address 0x7fcd82ae14ac>) at /home/andres/src/postgresql/src/include/storage/s_lock.h:228
> #1 0x000055bfbac42b4d in ConditionVariableCancelSleep () at /home/andres/src/postgresql/src/backend/storage/lmgr/condition_variable.c:173
> #2 0x000055bfba8e24ae in AbortTransaction () at /home/andres/src/postgresql/src/backend/access/transam/xact.c:2478
> #3 0x000055bfba8e4a2a in AbortOutOfAnyTransaction () at /home/andres/src/postgresql/src/backend/access/transam/xact.c:4387
> So, afaics no workers had yet attached, the leader accepted the cancel
> interrupt, the dsm segments were destroyed, and as part of cleanup
> cv_sleep_target was supposed to be reset, which fails, because it's
> memory has since been freed. Looking at how that can happen.
Oh. This seems to be a condition variable bug independent of PHJ. The
problem is that the DSM segment etc all get cleaned up in
*subtransaction* abort.
Afaict it's a bug that AbortTransaction() does
ConditionVariableCancelSleep() but AbortSubTransaction() does not,
despite the latter releasing dsm segments via
ResourceOwnerRelease(RESOURCE_RELEASE_BEFORE_LOCKS).
Adding that seems to fix the crash.
This seems like something we need to backpatch.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: condition variable cleanup and subtransactions
2017-12-21 11:00 condition variable cleanup and subtransactions Andres Freund <andres@anarazel.de>
@ 2017-12-21 11:46 ` Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-21 14:25 ` Re: condition variable cleanup and subtransactions Robert Haas <robertmhaas@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Munro @ 2017-12-21 11:46 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Pg Hackers <pgsql-hackers@postgresql.org>; pgsql-committers; Robert Haas <robertmhaas@gmail.com>
On Fri, Dec 22, 2017 at 12:00 AM, Andres Freund <andres@anarazel.de> wrote:
> Oh. This seems to be a condition variable bug independent of PHJ. The
> problem is that the DSM segment etc all get cleaned up in
> *subtransaction* abort.
>
> Afaict it's a bug that AbortTransaction() does
> ConditionVariableCancelSleep() but AbortSubTransaction() does not,
> despite the latter releasing dsm segments via
> ResourceOwnerRelease(RESOURCE_RELEASE_BEFORE_LOCKS).
>
> Adding that seems to fix the crash.
>
> This seems like something we need to backpatch.
Agreed. That affects any user of condition variables inside DSM
segments, including the released Parallel Index Scan and Parallel
Bitmap Heap Scan code.
--
Thomas Munro
http://www.enterprisedb.com
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: condition variable cleanup and subtransactions
2017-12-21 11:00 condition variable cleanup and subtransactions Andres Freund <andres@anarazel.de>
2017-12-21 11:46 ` Re: condition variable cleanup and subtransactions Thomas Munro <thomas.munro@enterprisedb.com>
@ 2017-12-21 14:25 ` Robert Haas <robertmhaas@gmail.com>
0 siblings, 0 replies; 3+ messages in thread
From: Robert Haas @ 2017-12-21 14:25 UTC (permalink / raw)
To: Thomas Munro <thomas.munro@enterprisedb.com>; +Cc: Andres Freund <andres@anarazel.de>; Pg Hackers <pgsql-hackers@postgresql.org>; pgsql-committers
On Thu, Dec 21, 2017 at 6:46 AM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
> On Fri, Dec 22, 2017 at 12:00 AM, Andres Freund <andres@anarazel.de> wrote:
>> Oh. This seems to be a condition variable bug independent of PHJ. The
>> problem is that the DSM segment etc all get cleaned up in
>> *subtransaction* abort.
>>
>> Afaict it's a bug that AbortTransaction() does
>> ConditionVariableCancelSleep() but AbortSubTransaction() does not,
>> despite the latter releasing dsm segments via
>> ResourceOwnerRelease(RESOURCE_RELEASE_BEFORE_LOCKS).
>>
>> Adding that seems to fix the crash.
>>
>> This seems like something we need to backpatch.
>
> Agreed. That affects any user of condition variables inside DSM
> segments, including the released Parallel Index Scan and Parallel
> Bitmap Heap Scan code.
Fixed.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2017-12-21 14:25 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-12-21 11:00 condition variable cleanup and subtransactions Andres Freund <andres@anarazel.de>
2017-12-21 11:46 ` Thomas Munro <thomas.munro@enterprisedb.com>
2017-12-21 14:25 ` Robert Haas <robertmhaas@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox