[pgpool-general: 9392] Re: WARNING: failed to lock semaphore

Tatsuo Ishii ishii at postgresql.org
Sat Mar 8 17:10:11 JST 2025


> Dear Tatsuo,
> 
> Thank you for the clarification.
> 
> Regarding the patch, can we apply the same patch to version 4.1.1 of Pgpool
> as well?

No, due to subtle difference of the code between the versions.
Attached is the patch for 4.1.1.

Best reagards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp


> Best Regards,
> Maria
> 
> 
> 
> 
> 
> 
> On Fri, Mar 7, 2025 at 6:20 PM Tatsuo Ishii <ishii at postgresql.org> wrote:
> 
>> Hi Maria,
>>
>> > Thank you for the instructions. I have applied the patch.
>> >
>> > Could you please clarify where I can find log entries that would indicate
>> > if `IpcSemaphoreKill` is called? Would I be able to find this information
>> > in the pgpool logs?
>>
>> Yes, in the pgpool log. You should see below if IpcSemaphoreKill is
>> called.
>>
>> +       elog(LOG, "remove semaphore set %lu", semId);
>>
>> For your information, elog() is a function to log the specified string
>> to pgpool log. The first argument is an expected level to be logged.
>> It is compared with log_ming_message parameter of pgpool. In the
>> default setting, "LOG" will be expected to be emitted if the code is
>> executed. The second and the third argument are like arguments of
>> printf.
>>
>> Best reagards,
>> --
>> Tatsuo Ishii
>> SRA OSS K.K.
>> English:
>> https://protect2.fireeye.com/v1/url?k=31323334-501d2dca-3131568e-454455534531-bbb96eab86ee7dab&q=1&e=4c6cb105-78aa-4ec9-b598-4a1b9e08a728&u=http%3A%2F%2Fwww.sraoss.co.jp%2Findex_en%2F
>> Japanese:http://www.sraoss.co.jp
>>
>> > Best Regards,
>> > Maria
>> >
>> >
>> > On Mon, Mar 3, 2025 at 7:26 PM Tatsuo Ishii <ishii at postgresql.org>
>> wrote:
>> >
>> >> Hi Maria,
>> >>
>> >> Sure.
>> >>
>> >> Assuming you have the patch at /tmp/log_semaphore_removal.patch
>> >> and you have the source at /somewhere/pgpool-II-4.4.6:
>> >>
>> >> cd /somewhere/pgpool-II-4.4.6
>> >> patch -p1 < ~/log_semaphore_removal.patch
>> >>
>> >> then you can compile and install pgpool as usual.
>> >>
>> >> Let me know if you have further questions.
>> >>
>> >> Best reagards,
>> >> --
>> >> Tatsuo Ishii
>> >> SRA OSS K.K.
>> >> English:
>> >>
>> https://protect2.fireeye.com/v1/url?k=31323334-501cfaeb-3131568e-454455535732-b2e8c335807c32bc&q=1&e=6e191e27-bfb2-4c07-873b-af81e2a9270c&u=http%3A%2F%2Fwww.sraoss.co.jp%2Findex_en%2F
>> >> Japanese:http://www.sraoss.co.jp
>> >>
>> >> > Dear Tatsuo,
>> >> >
>> >> > Thank you for the patch.
>> >> >
>> >> > I apologize for the inconvenience, but could you please provide
>> guidance
>> >> on
>> >> > how to apply the patch to our Pgpool installation? As mentioned
>> >> previously,
>> >> > we installed Pgpool from source.
>> >> >
>> >> > Thank you for your time and assistance.
>> >> >
>> >> > Best Regards,
>> >> > Maria
>> >> >
>> >> >
>> >> >
>> >> > On Sat, Mar 1, 2025 at 6:12 AM Tatsuo Ishii <ishii at postgresql.org>
>> >> wrote:
>> >> >
>> >> >> Hi Maria,
>> >> >>
>> >> >> > Dear Tatsuo,
>> >> >> >
>> >> >> > Thank you for your response.
>> >> >> >
>> >> >> > I understand your point regarding the semaphore acquisition.
>> However,
>> >> I
>> >> >> > would like to clarify that the semaphore error does not occur
>> >> immediately
>> >> >> > after startup. In our experience, the error manifests itself after
>> >> weeks
>> >> >> of
>> >> >> > running Pgpool. This behavior has been observed in both our staging
>> >> and
>> >> >> > production environments.
>> >> >> >
>> >> >> > If the semaphore configuration is established during Pgpool
>> startup,
>> >> it
>> >> >> > seems unusual that it would change weeks later. Could you please
>> >> >> elaborate
>> >> >> > on what might cause such a delayed configuration change?
>> >> >>
>> >> >> Ok, the semaphore is definitely created at the start up of pgpool. It
>> >> >> should never been removed until pgpool shuts down. If it's removed,
>> >> >> that must be a bug of pgpool. There's only 1 place where semaphore is
>> >> >> removed (IpcSemaphoreKill). Can you apply attached patch to confirm
>> >> >> the function is actually called? If you find semaphore is removed but
>> >> >> IpcSemaphoreKill is not called, then the semaphore was removed by
>> >> >> someone else.
>> >> >>
>> >> >> Best reagards,
>> >> >> --
>> >> >> Tatsuo Ishii
>> >> >> SRA OSS K.K.
>> >> >> English:
>> >> >>
>> >>
>> https://protect2.fireeye.com/v1/url?k=31323334-501cfaeb-3131568e-454455535732-b2e8c335807c32bc&q=1&e=af34ac69-01a0-4305-af59-968a7ca1f337&u=http%3A%2F%2Fwww.sraoss.co.jp%2Findex_en%2F
>> >> >> Japanese:http://www.sraoss.co.jp
>> >> >>
>> >> >>
>> >>
>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: log_semaphore_removal_4.1.1.patch
Type: application/octet-stream
Size: 411 bytes
Desc: not available
URL: <http://www.pgpool.net/pipermail/pgpool-general/attachments/20250308/0268af78/attachment.obj>


More information about the pgpool-general mailing list