Postmaster doesn't send SIGTERM to bgworker during fast shutdown when pmState == PM_STARTUP

From: Alexander Kukushkin <cyberdemn(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Postmaster doesn't send SIGTERM to bgworker during fast shutdown when pmState == PM_STARTUP
Date: 2018-08-26 16:00:23
Message-ID: CAFh8B=mvnD8+DZUfzpi50DoaDfZRDfd7S=gwj5vU9GYn8UvHkA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello hackers,

it is possible to start bgworker with bgw_start_time =
BgWorkerStart_PostmasterStart, which will be started immediately after
postmaster.

But if you try to do a fast shutdown while postmaster still in the
pmState == PM_STARTUP, bgworker will never get SIGTERM and postmaster
will wait forever.
At the same time, if you do immediate or smart shutdown, it works fine.

The problem is in the pmdie function. Proposed fix attached.

Regards,
--
Alexander Kukushkin

Attachment Content-Type Size
fast_shutdown_bgworker.patch text/x-patch 597 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-08-26 17:08:51 Multiple reporting of syslogger errors
Previous Message David Rowley 2018-08-26 11:42:48 Small patch to remove some duplicate words in comments