From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: bgworker sigusr1 handler |
Date: | 2013-04-10 19:09:30 |
Message-ID: | 20130410190929.GQ3751@eldon.alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Robert Haas escribió:
> Just for fun, I implemented a toy background worker tonight using the
> new bgworker framework. Generally, it went well, and I'm pleased with
> the design of the new facility.
Thanks.
> However, I did notice one oddity. I initialized the worker flags like
> this:
>
> worker.bgw_flags = BGWORKER_SHMEM_ACCESS;
>
> And... latches didn't work. It turns out that if you request database
> access, then the SIGUSR1 handler is set to procsignal_sigusr1_handler,
> which is fine. But if you don't, it gets set to SIG_IGN. And the
> result of *that* is that if someone sets a latch for which the
> background process is waiting, the background process fails to notice.
>
> Now, once you understand what's going on here, it's not hard to work
> around. But it seems to me that it would be a saner default to set
> the signal handler to something like the bgwriter handler, which just
> calls latch_sigusr1_handler.
Sounds sensible -- done that way.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2013-04-10 19:10:03 | Re: SIGHUP not received by custom bgworkers if postmaster is notified |
Previous Message | Stefan Kaltenbrunner | 2013-04-10 18:46:17 | Re: [COMMITTERS] pgsql: Get rid of USE_WIDE_UPPER_LOWER dependency in trigram constructi |