Commit 113d3591 authored by Fujii Masao's avatar Fujii Masao

Fix segmentation fault that commit ac22929a caused.

Commit ac22929a changed recoveryWakeupLatch so that it's reset to
NULL at the end of recovery. This change could cause a segmentation fault
in the buildfarm member 'elver'.

Previously the latch was reset to NULL after calling ShutdownWalRcv().
But there could be a window between ShutdownWalRcv() and the actual
exit of walreceiver. If walreceiver set the latch during that window,
the segmentation fault could happen.

To fix the issue, this commit changes walreceiver so that it sets
the latch only when the latch has not been reset to NULL yet.

Author: Fujii Masao
Discussion: https://postgr.es/m/5c1f8a85-747c-7bf9-241e-dd467d8a3586@iki.fi
parent 560564d3
...@@ -12673,7 +12673,8 @@ CheckPromoteSignal(void) ...@@ -12673,7 +12673,8 @@ CheckPromoteSignal(void)
void void
WakeupRecovery(void) WakeupRecovery(void)
{ {
SetLatch(XLogCtl->recoveryWakeupLatch); if (XLogCtl->recoveryWakeupLatch)
SetLatch(XLogCtl->recoveryWakeupLatch);
} }
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment