Re: BUG #16145: Not able to terminate active session - Mailing list pgsql-bugs

From MOHAN KUMAR DORAIRAJ
Subject Re: BUG #16145: Not able to terminate active session
Date
Msg-id CANnY_AOYf9bV2q0Z=R_0=CqWdUNw1Y3HT=RDQqgUO1dZ2D8wpQ@mail.gmail.com
Whole thread Raw
In response to Re: BUG #16145: Not able to terminate active session  (Mahendra Singh <mahi6run@gmail.com>)
Responses Re: BUG #16145: Not able to terminate active session
List pgsql-bugs
Dear Mahendra & Tomas

Please find the updated output of bdf command. Please let me know if you need additional log. 

(gdb) bt
#0  0x00007f5503e826e0 in __read_nocancel () from /lib64/libpthread.so.0
#1  0x00007f54eb392490 in snttread () from /db/oraclnt/12.2.0/lib/libclntsh.so.12.1
#2  0x00007f54eb391420 in nttfprd () from /db/oraclnt/12.2.0/lib/libclntsh.so.12.1
#3  0x00007f54eb387be0 in nsbasic_brc () from /db/oraclnt/12.2.0/lib/libclntsh.so.12.1
#4  0x00007f54eb37e654 in nioqrc () from /db/oraclnt/12.2.0/lib/libclntsh.so.12.1
#5  0x00007f54eb3987f9 in ttcdrv () from /db/oraclnt/12.2.0/lib/libclntsh.so.12.1
#6  0x00007f54eb382809 in nioqwa () from /db/oraclnt/12.2.0/lib/libclntsh.so.12.1
#7  0x00007f54eb36ce90 in upirtrc () from /db/oraclnt/12.2.0/lib/libclntsh.so.12.1
#8  0x00007f54eb378f86 in kpurcsc () from /db/oraclnt/12.2.0/lib/libclntsh.so.12.1
#9  0x00007f54eb3710c9 in kpuexec () from /db/oraclnt/12.2.0/lib/libclntsh.so.12.1
#10 0x00007f54eb36c639 in OCIStmtExecute () from /db/oraclnt/12.2.0/lib/libclntsh.so.12.1
#11 0x00007f54ec10eb32 in oracleExecuteQuery (session=0x1a16838, oraTable=0x1a0e558, paramList=<optimized out>) at oracle_utils.c:1964
#12 0x00007f54ec105940 in oracleIterateForeignScan (node=<optimized out>) at oracle_fdw.c:1432
#13 0x000000000062e58b in ForeignNext ()
#14 0x000000000060c2fa in ExecScan ()
#15 0x000000000061d90d in ExecHashJoin ()
#16 0x00000000006280af in ExecNestLoop ()
#17 0x000000000060401a in standard_ExecutorRun ()
#18 0x000000000074615b in PortalRunSelect ()
#19 0x000000000074751f in PortalRun ()
#20 0x0000000000744e6d in PostgresMain ()
#21 0x00000000004803e9 in ServerLoop ()
#22 0x00000000006d7b99 in PostmasterMain ()
#23 0x000000000048124f in main ()


Regards

Mohan

6670 4751



On Wed, Dec 4, 2019 at 2:22 AM Mahendra Singh <mahi6run@gmail.com> wrote:
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

On Tue, 3 Dec 2019 at 22:08, Tomas Vondra <tomas.vondra@2ndquadrant.com> 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


pgsql-bugs by date:

Previous
From: Stephen Frost
Date:
Subject: Re: BUG #16041: Error shows up both in pgAdmin and in Ruby (pg gem)- Segmentation fault
Next
From: Mark Phillips
Date:
Subject: Create database from template very slow