mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +03:00
When a bgworker exits, always call ReleasePostmasterChildSlot.
Commit e2ce9aa27b
was insufficiently
well thought out. Repair.
This commit is contained in:
@ -2856,23 +2856,25 @@ CleanupBackgroundWorker(int pid,
|
|||||||
* backend, any exit status other than 0 or 1 is considered a crash
|
* backend, any exit status other than 0 or 1 is considered a crash
|
||||||
* and causes a system-wide restart.
|
* and causes a system-wide restart.
|
||||||
*/
|
*/
|
||||||
if (rw->rw_worker.bgw_flags & BGWORKER_SHMEM_ACCESS)
|
if ((rw->rw_worker.bgw_flags & BGWORKER_SHMEM_ACCESS) != 0)
|
||||||
{
|
{
|
||||||
if (!EXIT_STATUS_0(exitstatus) && !EXIT_STATUS_1(exitstatus))
|
if (!EXIT_STATUS_0(exitstatus) && !EXIT_STATUS_1(exitstatus))
|
||||||
{
|
{
|
||||||
HandleChildCrash(pid, exitstatus, namebuf);
|
HandleChildCrash(pid, exitstatus, namebuf);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!ReleasePostmasterChildSlot(rw->rw_child_slot))
|
/*
|
||||||
{
|
* We must release the postmaster child slot whether this worker
|
||||||
/*
|
* is connected to shared memory or not, but we only treat it as
|
||||||
* Uh-oh, the child failed to clean itself up. Treat as a
|
* a crash if it is in fact connected.
|
||||||
* crash after all.
|
*/
|
||||||
*/
|
if (!ReleasePostmasterChildSlot(rw->rw_child_slot) &&
|
||||||
HandleChildCrash(pid, exitstatus, namebuf);
|
(rw->rw_worker.bgw_flags & BGWORKER_SHMEM_ACCESS) != 0)
|
||||||
return true;
|
{
|
||||||
}
|
HandleChildCrash(pid, exitstatus, namebuf);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get it out of the BackendList and clear out remaining data */
|
/* Get it out of the BackendList and clear out remaining data */
|
||||||
|
Reference in New Issue
Block a user