Re: BUG #16145: Not able to terminate active session
Mahendra Singh <[email protected]>
| Newsgroups | gmane.comp.db.postgresql.bugs |
|---|---|
| Message-ID | <CAKYtNArb5srWO_LW5CxonY6rH1tP4a_Raqfeb+g6ANzttqrn6w@mail.gmail.com> |
Hi Mohan, Please follow below steps to get stack trace(call stack/back trace) of postgres process. Step1) Fire "ps -aef | grep postgres" and identify the process id or PID of client. Ex: [mahendra@localhost bin]$ ps -aef | grep postgres mahendra 104917 1 0 23:40 ? 00:00:00 /home/mahendra/postgres_base_rp/postgres/inst/bin/postgres -D data mahendra 104920 104917 0 23:40 ? 00:00:00 postgres: checkpointer mahendra 104921 104917 0 23:40 ? 00:00:00 postgres: background writer mahendra 104922 104917 0 23:40 ? 00:00:00 postgres: walwriter mahendra 104923 104917 0 23:40 ? 00:00:00 postgres: stats collector mahendra 104924 104917 0 23:40 ? 00:00:00 postgres: logical replication launcher mahendra *105137* 6320 0 23:44 pts/1 00:00:00 ./psql postgres mahendra 105138 104917 0 23:44 ? 00:00:00 postgres: mahendra postgres [local] idle mahendra 105165 6859 0 23:44 pts/2 00:00:00 grep --color=auto postgres [mahendra@localhost bin]$ Here, my session id is 105137 (pid) means I connected as a client from server with 105137 PID. Step2) Now attach your PID using gdb. Ex: [mahendra@localhost bin]$ gdb attach 105137 GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-110.el7 -------------some more gdb info will be printed Step3) Now fire "bt" or "backtrace" command. Note: Don't exit the gdb from step2. 81 T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS) Missing separate debuginfos, use: debuginfo-install keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.15.1-19.el7.x86_64 libcom_err-1.42.9-12.el7_5.x86_64 libselinux-2.5-12.el7.x86_64 ncurses-libs-5.9-14.20130511.el7_4.x86_64 openssl-libs-1.0.2k-12.el7.x86_64 pcre-8.32-17.el7.x86_64 readline-6.2-10.el7.x86_64 zlib-1.2.7-17.el7.x86_64 (gdb) (gdb*) bt* #0 0x00007ffa46e517e0 in __read_nocancel () at ../sysdeps/unix/syscall-template.S:81 #1 0x00007ffa46c27097 in rl_getc () from /lib64/libreadline.so.6 #2 0x00007ffa46c278e7 in rl_read_key () from /lib64/libreadline.so.6 #3 0x00007ffa46c12b2f in readline_internal_char () from /lib64/libreadline.so.6 #4 0x00007ffa46c131e5 in readline () from /lib64/libreadline.so.6 #5 0x00000000004381a6 in gets_interactive (prompt=0x6f6a60 <destination.7461> "postgres=# ", query_buf=0x1a37b00) at input.c:92 #6 0x000000000043a9a0 in MainLoop (source=0x7ffa466ed640 <_IO_2_1_stdin_>) at mainloop.c:169 #7 0x000000000044ac5d in main (argc=2, argv=0x7ffefd61e818) at startup.c:441 (gdb) Thanks and Regards Mahendra Thalor EnterpriseDB: http://www.enterprisedb.com On Tue, 3 Dec 2019 at 22:08, Tomas Vondra <[email protected]> wrote: > On Wed, Dec 04, 2019 at 12:26:14AM +0800, MOHAN KUMAR DORAIRAJ wrote: > >Dear Tomas > > > >Please find the info > > > > > >-bash-4.2$ gdb -p 16647 > >GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-115.el7 > >Copyright (C) 2013 Free Software Foundation, Inc. > >License GPLv3+: GNU GPL version 3 or later < > http://gnu.org/licenses/gpl.html > >> > >This is free software: you are free to change and redistribute it. > >There is NO WARRANTY, to the extent permitted by law. Type "show copying" > >and "show warranty" for details. > >This GDB was configured as "x86_64-redhat-linux-gnu". > >For bug reporting instructions, please see: > ><http://www.gnu.org/software/gdb/bugs/>. > >Attaching to process 16647 > >Reading symbols from /usr/pgsql-11/bin/postgres...Reading symbols from > >/usr/pgsql-11/bin/postgres...(no debugging symbols found)...done. > >(no debugging symbols found)...done. > >Reading symbols from /lib64/libpthread.so.0...(no debugging symbols > >found)...done. > >[Thread debugging using libthread_db enabled] > >Using host libthread_db library "/lib64/libthread_db.so.1". > >... > >Reading symbols from /db/oraclnt/12.2.0/lib/libnque12.so...(no debugging > >symbols found)...done. > >Loaded symbols for /db/oraclnt/12.2.0/lib/libnque12.so > >0x00007f5503e826e0 in __read_nocancel () from /lib64/libpthread.so.0 > >Missing separate debuginfos, use: debuginfo-install > >postgresql11-server-11.2-2PGDG.rhel7.x86_64 > >(gdb) quit > >A debugging session is active. > > > > Inferior 1 [process 16647] will be detached. > > > >Quit anyway? (y or n) y > >Detaching from program: /usr/pgsql-11/bin/postgres, process 16647 > > > > This is still just the initial info gdb shows after attaching to the > process. You need to do "bt" or "backtrace" before quitting. > > > regards > > -- > Tomas Vondra http://www.2ndQuadrant.com > PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services > > >