R: R: R: BUG #6342: libpq blocks forever in "poll" function - Mailing list pgsql-bugs

From Andrea Grassi
Subject R: R: R: BUG #6342: libpq blocks forever in "poll" function
Date
Msg-id 001601ccbf32$a070f890$e152e9b0$@com
Whole thread Raw
In response to Re: R: R: BUG #6342: libpq blocks forever in "poll" function  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-bugs
This is the output of "bt full" command in gdb of my test program.=20
In this case the libpqs was not compiled in debug-mode.=20

(gdb) bt full
#0  0xffffe410 in __kernel_vsyscall ()
No symbol table info available.
#1  0xf76539cb in poll () from /lib/libc.so.6
No symbol table info available.
#2  0xf770d39a in pqSocketCheck () from /home/pg/pgsql/lib-32/libpq.so.5
No symbol table info available.
#3  0xf770d49d in pqWaitTimed () from /home/pg/pgsql/lib-32/libpq.so.5
No symbol table info available.
#4  0xf770d513 in pqWait () from /home/pg/pgsql/lib-32/libpq.so.5
No symbol table info available.
#5  0xf770c6d6 in PQgetResult () from /home/pg/pgsql/lib-32/libpq.so.5
No symbol table info available.
#6  0xf770c89c in PQexecFinish () from /home/pg/pgsql/lib-32/libpq.so.5
No symbol table info available.
#7  0x08048c3f in read_rigpia ()
No symbol table info available.
#8  0x08048ae9 in main ()

Here below I add the complete stack of my business application (blocked als=
o it) if it can be useful.
In this case, the libpq was compiled in debug-mode and we can see the value=
 parameter of function and the lines numbers of code.
Consider that the stack until PQexecFinish is the same as my test program.

(gdb) bt full
#0  0xffffe410 in __kernel_vsyscall ()
No symbol table info available.
#1  0xf6cdb9cb in poll () from /lib/libc.so.6
No symbol table info available.
#2  0xf766a39a in pqSocketPoll (conn=3D0x90e0838, forRead=3D1, forWrite=3D0=
, end_time=3D-1) at fe-misc.c:1082
No locals.
#3  pqSocketCheck (conn=3D0x90e0838, forRead=3D1, forWrite=3D0, end_time=3D=
-1)
    at fe-misc.c:1024
        result =3D -1
#4  0xf766a49d in pqWaitTimed (forRead=3D1, forWrite=3D0, conn=3D0x90e0838,=
=20
        finish_time=3D-1) at fe-misc.c:956
        result =3D <value optimized out>
#5  0xf766a513 in pqWait (forRead=3D1, forWrite=3D0, conn=3D0x90e0838)
    at fe-misc.c:939
No locals.
#6  0xf76696d6 in PQgetResult (conn=3D0x90e0838) at fe-exec.c:1554
    flushResult =3D 1
    res =3D 0x0
#7  0xf766989c in PQexecFinish (conn=3D0x90e0838) at fe-exec.c:1807
    result =3D 0x23
    lastResult =3D 0x0
#8  0xf767c3ec in pos_fetch (cur_dta=3D0x9485c80) at possup.c:930
   cmd =3D "FETCH 100 IN cur038_00063", '\000' <repeats 23 times>, "=C3=9Eh=
\031\b\230\021&\bl_R\t(\t=C3=9C=C3=BFm\216\027\b=C3=B8=C2=B8\016\t", '\000'=
 <repeats 12 times>, "=C3=B8=C2=B8\016\t\000\000\000\000\020\000\000\000\23=
0\021&\bl_R\t=C3=90=C2=B8\016\tX\t=C3=9C=C3=BF/\221\027\bl_R\t=C3=90=C2=B8\=
016\t\001\000\000"
   res =3D 0x0
   bind =3D 0x0
   buf =3D 0x0
   colinfo =3D 0x0
   colnum =3D 136712600
   len =3D 156393324
   type =3D 1
   row =3D -2356856
   null =3D 135921165
#9  0xf767b147 in dm_possup (request=3D35) at possup.c:216
   retcode =3D 135268645
   l =3D 156393324
   eliminata =3D 0
#10 0x081076f3 in dm_call_fnc ()
   No symbol table info available.
#11 0x080fda3d in dm_do_a_fetch ()
   No symbol table info available.
#12 0x080fd913 in dm_fetch ()
   No symbol table info available.
#13 0x08102974 in dm_execute ()
   No symbol table info available.
#14 0x080f96de in execute_cursor ()
   No symbol table info available.
#15 0x080f8556 in dm_do_dbms ()
   No symbol table info available.
#16 0x080ff22f in dm_call ()
   No symbol table info available.
#17 0x080f7edd in dm_dbms ()
   No symbol table info available.
#18 0xf76a655e in dm_dbms_drv (
    command=3D0xffdc0fa0 "with cursor cur038_00063 execute ")
    at r_sqlutifunc.c:1090
    No locals.
#19 0xf76ba4f6 in fetchCursorDb (curName=3D0xffdc1050 "cur038_00063")
    at sqlPanth.c:895
    buffer =3D "with cursor cur038_00063 execute ", '\000' <repeats 35 time=
s>, "=C3=A0*=C3=96=C3=B6\000\000\000\000\000\000\000\000=C3=B4/=C3=96=C3=B6=
=C3=87=C2=A5l=C3=B7X=C2=A2=C3=9C=C3=BF\030\020=C3=9C=C3=BF=C2=BE\220=C3=86=
=C3=B6P\020=C3=9C=C3=BF\r=C2=B6l=C3=B7(\020=C3=9C=C3=BF(\020=C3=9C=C3=BF\00=
4N<\b=C3=98\020=C3=9C=C3=BF+ k=C3=B7"
    app =3D 0x0
    retcode =3D 0
    command =3D 0xf76cb6e4 "execute"
    using_app =3D '\000' <repeats 1023 times>
#20 0xf76ba03d in fetchCursor (f0_file=3D38, curName=3D0xf76cbb40 "")
    at sqlPanth.c:759
    cursor =3D "cur038_00063", '\000' <repeats 115 times>
    app =3D 0x0
    retcode =3D 0
#21 0xf76bc020 in sqlRead (f0_file=3D38, w_dat=3D0xffdcc23c "", mode=3D7)
    at sqlRead.c:109
    msg =3D "\000\000\000\000\000\000\000\000\\^=C3=8D=C3=B6\000\000\000\00=
0\035\000\000\000\000\000\000\b\000\000\000\000^\002=C3=9D=C3=BF\000\000\00=
0\000ph\021\th\221=C3=9C=C3=BF\022=C3=ADj=C3=B7\224.o=C3=B7=C3=A0*=C3=96=C3=
=B6=C3=BF=C3=BF=C3=BF=C3=BF=C2=AB=C2=B7\005\b"
    s_where =3D "     \"cdart\" =3D '50110725'  ", '\000' <repeats 32740 ti=
mes>
    tslock =3D 0
    tpOrd =3D 68
    id_rec =3D 0
    Failed =3D 0
    failed_lock =3D 0
    old_w_dat =3D 0x0
    init_col =3D 0
    ret =3D 0
#22 0xf7699159 in ISREAD (f0_file=3D38, w_dat=3D0xffdcc23c "", mode=3D7)
    at r_dbswsql7.c:75
    ret =3D -2321976
    environ_save =3D '\000' <repeats 31 times>
#23 0x0807f6a4 in cal_prodat ()
    No symbol table info available.
#24 0x08057650 in read_mrp () at /home/uwrk/pgsai/WRKUNX/g_mrprun.c:465
    i =3D 0
    idx =3D 0
    dub =3D 4.8873862481069038e-313
    dub1 =3D -1.209991882770505e+266
    RFPO =3D {id =3D -153734240, cdart =3D "\027\000\000\000=C2=A8=C3=88=C3=
=9C=C3=BF=C3=A9=C3=AF=C3=84=C3=B6=C3=A0=C3=88=C3=9C=C3=BF\000",=20
    descr =3D "\000\000\n\000\000\000\000\000\000\000H=C3=89=C3=9C=C3=BF$\\=
\a\b=C3=A0=C3=88=C3=9C=C3=BF\004:9\b\031\000\000", bkini =3D 0, bkfin =3D 0=
, stato =3D 85 'U',=20
    cdpeg =3D '\000' <repeats 17 times>,=20
    grpeg =3D "\000\000\000\000\000\000\000\000\000\065\000\000\000\000\000=
\000\000\000\000", tscon =3D 0 '\000', fillc =3D "\000\000\000", qtfan =3D =
0,=20
    qtpro =3D 0, bkpeg =3D 0, lnuti =3D 0, anpia =3D "\000",=20
    nupia =3D "\000\000\000\000\000", nurig =3D "\000\000\000\000\000",=20
    nupid =3D "\000\000\000\000",=20
    fill =3D '\000' <repeats 45 times>, "\b=C3=8A=C3=9C=C3=BF=C3=8F=C2=A3\0=
05\bU\000\000\000=C2=B0\000\071\br=C3=89=C3=9C=C3=BFph\021\t\034=C3=9D2\b\0=
00\000\000\000=C2=B8=C3=89=C3=9C=C3=BF\215=C3=97,=C3=B7\220=C3=89PEZZI", '\=
000' <repeats 16 times>}
#25 0x08056f93 in cal_net () at /home/uwrk/pgsai/WRKUNX/g_mrprun.c:340
    lotlt =3D 0
    qta_app =3D 2.1220281700514382e-314
    qta_incr =3D 8.2383361536408976e-315
    n_volte =3D 121
    it =3D 136
    tsmax =3D 0
#26 0x08056f3c in mrp_run () at /home/uwrk/pgsai/WRKUNX/g_mrprun.c:317
    counter =3D 23036
#27 0x08056cf9 in conf_dat () at /home/uwrk/pgsai/WRKUNX/g_mrprun.c:250
    No locals.
#28 0x08056d56 in r_keybot (bm=3D36) at /home/uwrk/pgsai/WRKUNX/g_mrprun.c:=
265
    No locals.
#29 0x08056ccb in s_entry (nsc=3D0x9116870 "g_mrprun.jam", con=3D128)
    at /home/uwrk/pgsai/WRKUNX/g_mrprun.c:240
    result =3D 137551132
    stat_master =3D {st_dev =3D 651884900619439004, __pad1 =3D 62940,=20
    st_ino =3D 1, st_mode =3D 4141232116, st_nlink =3D 24, st_uid =3D 1,=20
    st_gid =3D 4292660168, st_rdev =3D 583229779520846990, __pad2 =3D 0,=20
    st_size =3D -2307184, st_blksize =3D 136712600, st_blocks =3D 152135792=
,=20
    st_atim =3D {tv_sec =3D 151778824, tv_nsec =3D -2307160}, st_mtim =3D {
    tv_sec =3D 134928144, tv_nsec =3D 136512150}, st_ctim =3D {
    tv_sec =3D 135726702, tv_nsec =3D 137550944}, __unused4 =3D 136712600,=
=20
    __unused5 =3D 152135792}
    stat_artico =3D {st_dev =3D 0, __pad1 =3D 4272, st_ino =3D 152140972,=
=20
    st_mode =3D 1, st_nlink =3D 151778780, st_uid =3D 136712600,=20
    st_gid =3D 4141232116, st_rdev =3D 128984812658, __pad2 =3D 12,
    st_size =3D 0, st_blksize =3D -153735180, st_blocks =3D -2307224,=20
    st_atim =3D {tv_sec =3D -154863084, tv_nsec =3D 151778768}, st_mtim =3D=
 {
    tv_sec =3D -2307184, tv_nsec =3D 12}, st_ctim =3D {tv_sec =3D 136250915=
,=20
    tv_nsec =3D 40}, __unused4 =3D 1, __unused5 =3D 151778768}
    stat_disbas =3D {st_dev =3D 135667194, __pad1 =3D 51960,=20
    st_ino =3D 4292659912, st_mode =3D 136712600, st_nlink =3D 0, st_uid =
=3D 3,=20
    st_gid =3D 4292659928, st_rdev =3D 5514874160500, __pad2 =3D 48,=20
    st_size =3D -153730728, st_blksize =3D 136152200, st_blocks =3D 1367126=
00,=20
    st_atim =3D {tv_sec =3D 152153576, tv_nsec =3D -2307304}, st_mtim =3D {
    tv_sec =3D 136147953, tv_nsec =3D 151914368}, st_ctim =3D {
    tv_sec =3D 151916720, tv_nsec =3D 152151728}, __unused4 =3D 4140104046,=
=20
    __unused5 =3D 0}
#30 0x08170570 in sm_call_fnc ()
    No symbol table info available.
#31 0x081a7ddf in sm_fmfunc ()
    No symbol table info available.
#32 0x081a7a20 in sm_frmtail ()
    No symbol table info available.
#33 0x081a7772 in sm_frmfile ()
    No symbol table info available.
#34 0x081a19ca in sm_r_window ()
    No symbol table info available.
#35 0x081a18c8 in sm_r_there ()
    No symbol table info available.
#36 0x08190cd4 in sm_jform ()
    No symbol table info available.
#37 0x08190135 in sm_jexec_top ()
    No symbol table info available.
#38 0x08190015 in sm_jtop ()
    No symbol table info available.
#39 0x0807d11b in start_up ()
    No symbol table info available.
#40 0x08056a71 in common_main (argc=3D2, argv=3D0xffdcd444)
    at /home/pgsai/include/p_mainfi.h:11
    No locals.
#41 0x08056998 in main (argc=3D2, argv=3D0xffdcd444)
    at /home/pgsai/include/p_mainnm.h:17
    No locals.

I am available for further requests.=20

Regards, Andrea=20


-----Messaggio originale-----
Da: Alvaro Herrera [mailto:alvherre@commandprompt.com]=20
Inviato: marted=C3=AC 20 dicembre 2011 16.43
A: Andrea Grassi
Cc: 'Craig Ringer'; Tom Lane; Pg Bugs
Oggetto: Re: R: R: [BUGS] BUG #6342: libpq blocks forever in "poll" function


Excerpts from Andrea Grassi's message of mar dic 20 06:01:55 -0300 2011:
> Sorry if I insist, but now I have the case at hand (my test program is no=
w blocked), so I can check and verify all what you want.
> I would like to know if it can be a libpq bug or if you think the fault i=
s due to a system bug or to a machine issue and in this case I would be gra=
teful if you could give me a hint on what could be.

Please attach GDB to the stuck process (gdb -p `pidof testprogram`) and
grab a backtrace (bt full).

--=20
=C3=81lvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

pgsql-bugs by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: R: R: BUG #6342: libpq blocks forever in "poll" function
Next
From: "Andrea Grassi"
Date:
Subject: R: R: R: BUG #6342: libpq blocks forever in "poll" function