Re: BackendPidGetProc doesn't return PGPROC for background worker? - Mailing list pgsql-hackers

From Amit Langote
Subject Re: BackendPidGetProc doesn't return PGPROC for background worker?
Date
Msg-id 55555314.7030508@lab.ntt.co.jp
Whole thread Raw
In response to Re: BackendPidGetProc doesn't return PGPROC for background worker?  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Responses Re: BackendPidGetProc doesn't return PGPROC for background worker?
List pgsql-hackers
On 2015-05-15 AM 10:39, Amit Langote wrote:
> On 2015-05-15 AM 05:01, Pavel Stehule wrote:
>>
>> I am trying to start bgworker from bgworker and create communication
>> between these process. I have a code based on test_shm_mq. This code fails
>> because BackendPidGetProc doesn't find related bgworker process, although
>> the registrant process is living
>>
> 
> One reason for this may be that the worker was not started with the flag
> BGWORKER_SHMEM_ACCESS which is necessary to perform InitProcess() that would
> initialize a PGPROC entry for it. But if you'd used the same method for
> initializing workers as test_shm_mq_setup(), then it should have.
> 

It seems in addition, a BackgroundWorkerInitializeConnection() is also
necessary for the PGPROC entry of the worker to be visible to others. I do not
see that done anywhere in test_shm_mq(); so perhaps that's missing?

Thanks,
Amit




pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: pg_upgrade cleanup
Next
From: Bruce Momjian
Date:
Subject: Re: pg_upgrade cleanup