BUG #14680: startup process on standby encounter a deadlock of TwoPhaseStateLock when redo 2PC xlog

From: wangchuanting(at)huawei(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14680: startup process on standby encounter a deadlock of TwoPhaseStateLock when redo 2PC xlog
Date: 2017-05-31 03:32:28
Message-ID: 20170531033228.1487.10124@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

The following bug has been logged on the website:

Bug reference: 14680
Logged by: chuanting wang
Email address: wangchuanting(at)huawei(dot)com
PostgreSQL version: 10beta1
Operating system: SuSE
Description:

startup process on standby encounter a deadlock of TwoPhaseStateLock when
redo 2PC xlog.

the stack is:
Thread 6 (Thread 0x7f002e3ff700 (LWP 35305)):
#0 0x00007f1106167627 in semop () from /lib64/libc.so.6
#1 0x0000000000ce5622 in PGSemaphoreLock(PGSemaphoreData*, bool) ()
#2 0x0000000000d73e4d in LWLockAcquire(LWLockId, LWLockMode) ()
#3 0x0000000000969028 in RemoveGXact(GlobalTransactionData*) ()
#4 0x000000000096b254 in ProcessTwoPhaseBuffer(unsigned int, XLogRecPtr,
bool, bool, bool) ()
#5 0x000000000096b6b8 in PrescanPreparedTransactions(unsigned int**, int*)
()
#6 0x000000000097af97 in xlog_redo(XLogReaderState*) ()
#7 0x00000000009839df in StartupXLOG() ()
#8 0x0000000000cffd0b in StartupProcessMain() ()
#9 0x0000000000991539 in AuxiliaryProcessMain(int, char**) ()
#10 0x0000000000cfb209 in SubPostmasterMain(int, char**) ()
#11 0x0000000000cfb4f2 in MainStarterThreadFunc(void*) ()
#12 0x00007f11099a17b6 in start_thread () from /lib64/libpthread.so.0
#13 0x00007f1106165d6d in clone () from /lib64/libc.so.6
#14 0x0000000000000000 in ?? ()

the reason is:
when do PrescanPreparedTransactions, startup process already granted a
shared lock on TwoPhaseStateLock, then it called RemoveGXact, but in
RemoveGXact it acquired exclusive lock on TwoPhaseStateLock, so it blocked
by itself

anyone, has some idea on how to fix it?

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Gustavo Campos 2017-05-31 12:51:07 Re: PGDG Repository for RHEL6 is bronen, populated with RHEL7 packages
Previous Message Thomas Munro 2017-05-31 00:44:01 Re: BUG #14668: BRIN open autosummarize=on , database will crash

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2017-05-31 03:41:50 Re: Patch: Add --no-comments to skip COMMENTs with pg_dump
Previous Message Peter Eisentraut 2017-05-31 03:10:31 Re: Why does logical replication launcher set application_name?