[BUGS] BUG #14680: startup process on standby encounter a deadlock ofTwoPhaseStateLock when redo 2PC xlog - Mailing list pgsql-bugs

From wangchuanting@huawei.com
Subject [BUGS] BUG #14680: startup process on standby encounter a deadlock ofTwoPhaseStateLock when redo 2PC xlog
Date
Msg-id 20170531033228.1487.10124@wrigleys.postgresql.org
Whole thread Raw
Responses Re: [BUGS] BUG #14680: startup process on standby encounter a deadlock of TwoPhaseStateLock when redo 2PC xlog  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      14680
Logged by:          chuanting  wang
Email address:      wangchuanting@huawei.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?



--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

pgsql-bugs by date:

Previous
From: Thomas Munro
Date:
Subject: Re: [BUGS] BUG #14668: BRIN open autosummarize=on , database will crash
Next
From: Gustavo Campos
Date:
Subject: Re: [BUGS] PGDG Repository for RHEL6 is bronen, populated with RHEL7 packages