<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:"comic sans ms",sans-serif"><div style="color:rgb(31,31,31);font-family:Roboto,Helvetica,Arial,sans-serif;font-size:14px;letter-spacing:0.2px">Dear Tatsuo,</div><div style="color:rgb(31,31,31);font-family:Roboto,Helvetica,Arial,sans-serif;font-size:14px;letter-spacing:0.2px"><br></div><div style="color:rgb(31,31,31);font-family:Roboto,Helvetica,Arial,sans-serif;font-size:14px;letter-spacing:0.2px">Thank you for your guidance.</div><div style="color:rgb(31,31,31);font-family:Roboto,Helvetica,Arial,sans-serif;font-size:14px;letter-spacing:0.2px"><br></div><div style="color:rgb(31,31,31);font-family:Roboto,Helvetica,Arial,sans-serif;font-size:14px;letter-spacing:0.2px">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.</div><div style="color:rgb(31,31,31);font-family:Roboto,Helvetica,Arial,sans-serif;font-size:14px;letter-spacing:0.2px"><br></div><div style="color:rgb(31,31,31);font-family:Roboto,Helvetica,Arial,sans-serif;font-size:14px;letter-spacing:0.2px"><b>4.4.6</b><br><br><b>$ gdb /local/opt/points/pgpool/4.4.6/bin/pgpool</b><br> <br><b>(gdb) b main.c:363</b><br>Breakpoint 1 at 0xf70f: file main/main.c, line 363.<br><br><b>(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</b><br>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<br>[Thread debugging using libthread_db enabled]<br>Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".<br><br>Breakpoint 1, main (argc=<optimized out>, argv=<optimized out>) at main/main.c:363<br>363 pool_semaphore_create(MAX_NUM_SEMAPHORES);<br><br><b>(gdb) s</b><br>pool_semaphore_create (numSems=8) at utils/pool_sema.c:79<br>79 {<br><br><b>(gdb) n</b><br>83 semId = semget(IPC_PRIVATE, numSems, IPC_CREAT | IPC_EXCL | IPCProtection);<br><br><b>(gdb) n</b><br>85 if (semId < 0)<br><br><b>(gdb) p semId</b><br>$1 = 25<br><br><b>(gdb) p semId</b><br>$2 = 25</div><div style="color:rgb(31,31,31);font-family:Roboto,Helvetica,Arial,sans-serif;font-size:14px;letter-spacing:0.2px"><br>(gdb) quit</div><div style="color:rgb(31,31,31);font-family:Roboto,Helvetica,Arial,sans-serif;font-size:14px;letter-spacing:0.2px"><br></div><div style="color:rgb(31,31,31);font-family:Roboto,Helvetica,Arial,sans-serif;font-size:14px;letter-spacing:0.2px"><b>4.1.1</b><br><br><b>$ gdb /local/opt/points/pgpool/4.1.1/bin/pgpool</b><br><br><b>(gdb) b main.c:363</b><br>Breakpoint 1 at 0xe390: file main/main.c, line 370.<br><br><b>(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</b><br>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<br>[Thread debugging using libthread_db enabled]<br>Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".<br>[Detaching after vfork from child process 3051999]<br>[Detaching after fork from child process 3052001]<br><br>Program received signal SIGUSR1, User defined signal 1.<br>0x00007ffff78ad45c in __GI___sigsuspend (set=set@entry=0x7fffffff20a0) at ../sysdeps/unix/sysv/linux/sigsuspend.c:26<br>26 ../sysdeps/unix/sysv/linux/sigsuspend.c: No such file or directory.<br><br><b>(gdb) s</b><br>sigusr1_handler (sig=10) at main/pgpool_main.c:1528<br>1528 {<br><br><b>(gdb) n</b><br>1529 int save_errno = errno;<br><br><b>(gdb) n</b><br>1531 POOL_SETMASK(&BlockSig);<br><br><b>(gdb) p semId</b><br>$1 = 24</div><div style="color:rgb(31,31,31);font-family:Roboto,Helvetica,Arial,sans-serif;font-size:14px;letter-spacing:0.2px"><br></div><div style="color:rgb(31,31,31);font-family:Roboto,Helvetica,Arial,sans-serif;letter-spacing:0.2px">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. </div><div style="color:rgb(31,31,31);font-family:Roboto,Helvetica,Arial,sans-serif;font-size:14px;letter-spacing:0.2px"><br></div><div style="color:rgb(31,31,31);font-family:Roboto,Helvetica,Arial,sans-serif;font-size:14px;letter-spacing:0.2px">Please let me know if you have any further questions.</div><div style="color:rgb(31,31,31);font-family:Roboto,Helvetica,Arial,sans-serif;font-size:14px;letter-spacing:0.2px"><br></div><div style="color:rgb(31,31,31);font-family:Roboto,Helvetica,Arial,sans-serif;font-size:14px;letter-spacing:0.2px">Best Regards,</div><div style="color:rgb(31,31,31);font-family:Roboto,Helvetica,Arial,sans-serif;font-size:14px;letter-spacing:0.2px">Maria</div></div><input name="virtru-metadata" type="hidden" value="{"email-policy":{"disableCopyPaste":false,"disablePrint":false,"disableForwarding":false,"enableNoauth":false,"expandedWatermarking":false,"expires":false,"sms":false,"expirationNum":1,"expirationUnit":"days","isManaged":false,"persistentProtection":false},"attachments":{},"compose-id":"6","compose-window":{"secure":false}}"></div><div dir="ltr"><div style="font-family:"comic sans ms",sans-serif"><br></div></div><div dir="ltr"><div style="font-family:"comic sans ms",sans-serif"><br></div></div><br><div class="gmail_quote" style=""><div dir="ltr" class="gmail_attr">On Wed, Feb 19, 2025 at 5:21 AM Tatsuo Ishii <<a href="mailto:ishii@postgresql.org" target="_blank">ishii@postgresql.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> Dear Tatsuo,<br>
> <br>
> Thank you for your guidance.<br>
<br>
You are welcome.<br>
<br>
> I would appreciate it if you could provide me with the specific steps on<br>
> how to attach gdb to pgpool and set the breakpoint at<br>
> pool_semaphore_create(). I am not familiar with this process and would<br>
> value your expertise.<br>
<br>
Sure. The detailed instruction depends on the OS you are using. I<br>
presume you are using Linux.<br>
<br>
Assume the command line to start pgppol is as follows:<br>
<br>
/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<br>
<br>
In this case you can start gdb:<br>
<br>
gdb /usr/local/bin/pgpool<br>
<br>
[snip]<br>
<br>
(gdb) b main.c:363<br>
Breakpoint 1 at 0xf82f: file main/main.c, line 363.<br>
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<br>
[Thread debugging using libthread_db enabled]<br>
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".<br>
<br>
(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<br>
[Thread debugging using libthread_db enabled]<br>
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".<br>
<br>
Breakpoint 1, main (argc=<optimized out>, argv=<optimized out>) at main/main.c:363<br>
363 pool_semaphore_create(MAX_NUM_SEMAPHORES);<br>
(gdb) s<br>
pool_semaphore_create (numSems=8) at utils/pool_sema.c:79<br>
79 {<br>
(gdb) n<br>
83 semId = semget(IPC_PRIVATE, numSems, IPC_CREAT | IPC_EXCL | IPCProtection);<br>
(gdb) n<br>
85 if (semId < 0)<br>
(gdb) p semId<br>
$1 = 819258<br>
<br>
In this case semget is called and the semaphore set identifier is<br>
returned (this is normal).<br>
<br>
If you see semId is -1, then an error occured.<br>
<br>
(gdb) quit<br>
<br>
This will detach gdb session and kill pgpool process. Note that since<br>
"-n" option is given, pgpool process does not fork child process and<br>
detach the control terminal. If you do not give -n option, you need to<br>
use "set follow-fork-mode child" command of gdb. You type this command<br>
before "run" command.<br>
<br>
If you have further question, please let me know.<br>
<br>
Best reagards,<br>
--<br>
Tatsuo Ishii<br>
SRA OSS K.K.<br>
English: <a href="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" rel="noreferrer" target="_blank">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</a><br>
Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.jp</a><br>
</blockquote></div>
</div>