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

Maria Nieva maria.nieva at points.com
Wed Feb 26 04:30:37 JST 2025


Dear Tatsuo,

Thank you for your guidance.

I followed your instructions and ran gdb on both pgpool 4.1.1 and pgpool
4.4.6. I have the results for your review.

*4.4.6*

*$ gdb /local/opt/points/pgpool/4.4.6/bin/pgpool*

*(gdb) b main.c:363*
Breakpoint 1 at 0xf70f: file main/main.c, line 363.

*(gdb) run -n -D --config-file=/home/postgres/config/8000/etc/pgpool.conf
--hba-file=/home/postgres/config/8000/etc/pool_hba.conf
--pcp-file=/home/postgres/config/8000/etc/pcp.conf*
Starting program: /local/opt/points/pgpool/4.4.6/bin/pgpool -n -D
--config-file=/home/postgres/config/8000/etc/pgpool.conf
--hba-file=/home/postgres/config/8000/etc/pool_hba.conf
--pcp-file=/home/postgres/config/8000/etc/pcp.conf
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, main (argc=<optimized out>, argv=<optimized out>) at
main/main.c:363
363             pool_semaphore_create(MAX_NUM_SEMAPHORES);

*(gdb) s*
pool_semaphore_create (numSems=8) at utils/pool_sema.c:79
79      {

*(gdb) n*
83              semId = semget(IPC_PRIVATE, numSems, IPC_CREAT | IPC_EXCL |
IPCProtection);

*(gdb) n*
85              if (semId < 0)

*(gdb) p semId*
$1 = 25

*(gdb) p semId*
$2 = 25

(gdb) quit

*4.1.1*

*$ gdb /local/opt/points/pgpool/4.1.1/bin/pgpool*

*(gdb) b main.c:363*
Breakpoint 1 at 0xe390: file main/main.c, line 370.

*(gdb) run -n -D --config-file=/home/postgres/config/6000/etc/pgpool.conf
--hba-file=/home/postgres/config/6000/etc/pool_hba.conf
--pcp-file=/home/postgres/config/6000/etc/pcp.conf*
Starting program: /local/opt/points/pgpool/4.1.1/bin/pgpool -n -D
--config-file=/home/postgres/config/6000/etc/pgpool.conf
--hba-file=/home/postgres/config/6000/etc/pool_hba.conf
--pcp-file=/home/postgres/config/6000/etc/pcp.conf
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Detaching after vfork from child process 3051999]
[Detaching after fork from child process 3052001]

Program received signal SIGUSR1, User defined signal 1.
0x00007ffff78ad45c in __GI___sigsuspend (set=set at entry=0x7fffffff20a0) at
../sysdeps/unix/sysv/linux/sigsuspend.c:26
26      ../sysdeps/unix/sysv/linux/sigsuspend.c: No such file or directory.

*(gdb) s*
sigusr1_handler (sig=10) at main/pgpool_main.c:1528
1528    {

*(gdb) n*
1529            int                     save_errno = errno;

*(gdb) n*
1531            POOL_SETMASK(&BlockSig);

*(gdb) p semId*
$1 = 24

We are currently getting the semaphore error on 4.1.1 after it has been on
for over 2 weeks.  4.4.6 does not seem to encounter it at the moment.  We
are at a loss as to what is causing it.

Please let me know if you have any further questions.

Best Regards,
Maria



On Wed, Feb 19, 2025 at 5:21 AM Tatsuo Ishii <ishii at postgresql.org> wrote:

> > Dear Tatsuo,
> >
> > Thank you for your guidance.
>
> You are welcome.
>
> > I would appreciate it if you could provide me with the specific steps on
> > how to attach gdb to pgpool and set the breakpoint at
> > pool_semaphore_create(). I am not familiar with this process and would
> > value your expertise.
>
> Sure. The detailed instruction depends on the OS you are using. I
> presume you are using Linux.
>
> Assume the command line to start pgppol is as follows:
>
> /usr/local/bin/pgpool -D -n -f
> /home/t-ishii/work/Pgpool-II/current/x/etc/pgpool.conf -F
> /home/t-ishii/work/Pgpool-II/current/x/etc/pcp.conf -a
> /home/t-ishii/work/Pgpool-II/current/x/etc/pool_hba.conf
>
> In this case you can start gdb:
>
> gdb /usr/local/bin/pgpool
>
> [snip]
>
> (gdb) b main.c:363
> Breakpoint 1 at 0xf82f: file main/main.c, line 363.
> Starting program: /usr/local/bin/pgpool -D -n -f
> /home/t-ishii/work/Pgpool-II/current/x/etc/pgpool.conf -F
> /home/t-ishii/work/Pgpool-II/current/x/etc/pcp.conf -a
> /home/t-ishii/work/Pgpool-II/current/x/etc/pool_hba.conf
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
>
> (gdb) run -D -n -f /home/t-ishii/work/Pgpool-II/current/x/etc/pgpool.conf
> -F /home/t-ishii/work/Pgpool-II/current/x/etc/pcp.conf -a
> /home/t-ishii/work/Pgpool-II/current/x/etc/pool_hba.conf
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
>
> Breakpoint 1, main (argc=<optimized out>, argv=<optimized out>) at
> main/main.c:363
> 363             pool_semaphore_create(MAX_NUM_SEMAPHORES);
> (gdb) s
> pool_semaphore_create (numSems=8) at utils/pool_sema.c:79
> 79      {
> (gdb) n
> 83              semId = semget(IPC_PRIVATE, numSems, IPC_CREAT | IPC_EXCL
> | IPCProtection);
> (gdb) n
> 85              if (semId < 0)
> (gdb) p semId
> $1 = 819258
>
> In this case semget is called and the semaphore set identifier is
> returned (this is normal).
>
> If you see semId is -1, then an error occured.
>
> (gdb) quit
>
> This will detach gdb session and kill pgpool process.  Note that since
> "-n" option is given, pgpool process does not fork child process and
> detach the control terminal. If you do not give -n option, you need to
> use "set follow-fork-mode child" command of gdb. You type this command
> before "run" command.
>
> If you have further question, please let me know.
>
> Best reagards,
> --
> Tatsuo Ishii
> SRA OSS K.K.
> English:
> https://protect2.fireeye.com/v1/url?k=31323334-501cfaeb-3131568e-454455535732-b2e8c335807c32bc&q=1&e=9cc66e87-603c-43bc-8e55-05d3f3a6e077&u=http%3A%2F%2Fwww.sraoss.co.jp%2Findex_en%2F
> Japanese:http://www.sraoss.co.jp
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pgpool.net/pipermail/pgpool-general/attachments/20250225/094767ce/attachment.htm>


More information about the pgpool-general mailing list