Robert Haas escribió:
> A related point that's been bugging me for a while, and has just
> struck me again, is that background workers for which
> BGWORKER_SHMEM_ACCESS is not passed probably ought to be detaching
> shared memory (and DSMs). Currently, and since Alvaro originally
> added the facility, the death of a non-BGWORKER_SHMEM_ACCESS backend
> is used in postmaster.c to decide whether to call HandleChildCrash().
> But such workers could still clobber shared memory arbitrarily; they
> haven't unmapped it. Oddly, the code in postmaster.c is only cares
> about the flag when checking EXIT_STATUS_0()/EXIT_STATUS_1(), not when
> checking ReleasePostmasterChildSlot()...
Clearly there's not a lot of consistency on that. I don't think I had
made up my mind completely about such details. I do remember that
unmapping/detaching the shared memory segment didn't cross my mind; the
flag, as I recall, only controls (controlled) whether to attach to it
explicitely.
IOW feel free to whack around.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services