File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -2856,23 +2856,25 @@ CleanupBackgroundWorker(int pid,
28562856 * backend, any exit status other than 0 or 1 is considered a crash
28572857 * and causes a system-wide restart.
28582858 */
2859- if (rw -> rw_worker .bgw_flags & BGWORKER_SHMEM_ACCESS )
2859+ if (( rw -> rw_worker .bgw_flags & BGWORKER_SHMEM_ACCESS ) != 0 )
28602860 {
28612861 if (!EXIT_STATUS_0 (exitstatus ) && !EXIT_STATUS_1 (exitstatus ))
28622862 {
28632863 HandleChildCrash (pid , exitstatus , namebuf );
28642864 return true;
28652865 }
2866+ }
28662867
2867- if (!ReleasePostmasterChildSlot (rw -> rw_child_slot ))
2868- {
2869- /*
2870- * Uh-oh, the child failed to clean itself up. Treat as a
2871- * crash after all.
2872- */
2873- HandleChildCrash (pid , exitstatus , namebuf );
2874- return true;
2875- }
2868+ /*
2869+ * We must release the postmaster child slot whether this worker
2870+ * is connected to shared memory or not, but we only treat it as
2871+ * a crash if it is in fact connected.
2872+ */
2873+ if (!ReleasePostmasterChildSlot (rw -> rw_child_slot ) &&
2874+ (rw -> rw_worker .bgw_flags & BGWORKER_SHMEM_ACCESS ) != 0 )
2875+ {
2876+ HandleChildCrash (pid , exitstatus , namebuf );
2877+ return true;
28762878 }
28772879
28782880 /* Get it out of the BackendList and clear out remaining data */
You can’t perform that action at this time.
0 commit comments