[pgpool-general: 9370] Re: WARNING: failed to lock semaphore
Tatsuo Ishii
ishii at postgresql.org
Wed Feb 19 19:21:11 JST 2025
> 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: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
More information about the pgpool-general
mailing list