PostgreSQL client hangs sometimes on 'EXEC SQL PREPARE sid_sisisinst FROM :select_anw;'

From: Matthias Apitz <guru(at)unixarea(dot)de>
To: Postgres general <pgsql-general(at)postgresql(dot)org>
Subject: PostgreSQL client hangs sometimes on 'EXEC SQL PREPARE sid_sisisinst FROM :select_anw;'
Date: 2020-04-27 12:21:23
Message-ID: 20200427122123.GA11416@sh4-5.1blu.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hello,

I encounter from time to time that one of our ESQL/C clients hangs with
the details described below for ever, while accessing on startup a table
'sisisinst' which has only some 50 rows, all of CHAR columns. Other ESQL/C clients
start up fine (they all check this table 'sisisinst' on startup to
verify the correct version of our application) Also SQL works
fine.

What can I do to get to the source of the problem? Thanks

matthias

ESQL/C statement:

EXEC SQL PREPARE sid_sisisinst FROM :select_anw;

host variable :select_anw contains:

(gdb) p select_anw
$2 = "SELECT ctid, * from sisisinst WHERE version = :v1", '\000'

process PID 23957 is hanging in poll() on network socket to PostgreSQL server:
(Version 11.4 on Linux)

(gdb) bt
#0 0x00007ff9020c2664 in poll () from /lib64/libc.so.6
#1 0x00007ff90144c22f in pqSocketPoll () from /usr/local/sisis-pap/pgsql/lib/libpq.so.5
#2 0x00007ff90144c0ff in pqSocketCheck () from /usr/local/sisis-pap/pgsql/lib/libpq.so.5
#3 0x00007ff90144bf83 in pqWaitTimed () from /usr/local/sisis-pap/pgsql/lib/libpq.so.5
#4 0x00007ff90144bf55 in pqWait () from /usr/local/sisis-pap/pgsql/lib/libpq.so.5
#5 0x00007ff901447d3a in PQgetResult () from /usr/local/sisis-pap/pgsql/lib/libpq.so.5
#6 0x00007ff901448478 in PQexecFinish () from /usr/local/sisis-pap/pgsql/lib/libpq.so.5
#7 0x00007ff90144819a in PQprepare () from /usr/local/sisis-pap/pgsql/lib/libpq.so.5
#8 0x00007ff901cc788d in prepare_common () from /usr/local/sisis-pap/pgsql/lib/libecpg.so.6
#9 0x00007ff901cc7a26 in ECPGprepare () from /usr/local/sisis-pap/pgsql/lib/libecpg.so.6
#10 0x00007ff9044a86ee in select_record (scroll=1, lock=0, key=2,
sel_anw=0x7ffed86186c0 "SELECT ctid, * from %s", where_anw=0x7ffed8617330 "%s = :v1",
p_daten=0x7ff904dd7700 <hrec_sisisinst>, i_between=0, p_oben=0x7ffed86171d0, order_by=0x0,
auf_ab=0x0, group_by=0x0, having=0x0, into_temp=0x0, count=0x7ffed8617328) at sisisinst.pgc:925
#11 0x00007ff9044a7a8d in sisisinst (zugriff=1, scroll=1, lock=0, key=2, sto=-20000,
p_daten=0x7ffed8618c30, sel_anw=0x7ffed86186c0 "SELECT ctid, * from %s",
where_anw=0x7ffed8617330 "%s = :v1", p_btw_daten=0x0, order_by=0x0, auf_ab=0x0, group_by=0x0,
having=0x0, into_temp=0x0, count=0x7ffed8617328) at sisisinst.pgc:450
#12 0x00007ff9043718a5 in DB_rdir (tabmodul=0x7ff9044a7639 <sisisinst>, key=2, scroll=1, lock=0,
p_daten=0x7ffed8618c30) at dbcall.pgc:1665
#13 0x00007ff90436f6c9 in DB_ChkVer () at dbcall.pgc:307
#14 0x00007ff9043708d3 in DB_opdbP (mode=1) at dbcall.pgc:840
#15 0x00007ff90436fff8 in DB_opdb () at dbcall.pgc:543
#16 0x0000000000405efa in InitIndex (setid=FSTAB_Personen) at ./INDEX.c:1000
#17 0x0000000000405241 in main (argc=2, argv=0x7ffed8619fa8) at ./INDEX.c:412

running PostgreSQL processes:

# ps ax | grep postgres:
329 pts/13 S+ 0:00 grep --color=auto postgres:
2354 ? Ss 0:17 postgres: checkpointer
2355 ? Ss 0:09 postgres: background writer
2356 ? Ss 0:10 postgres: walwriter
2357 ? Ss 0:04 postgres: autovacuum launcher
2358 ? Ss 0:00 postgres: archiver last was 000000010000000F00000062
2359 ? Ss 0:31 postgres: stats collector
2360 ? Ss 0:00 postgres: logical replication launcher
14044 ? Ss 0:00 postgres: sisis sisis ::1(53426) idle
14100 ? Ss 0:00 postgres: sisis sisis ::1(53432) idle
16852 ? Ss 0:00 postgres: sisis sisis ::1(53486) idle
17575 ? Ss 0:00 postgres: sisis sisis ::1(48736) idle
17577 ? Ss 0:00 postgres: sisis sisis ::1(48742) idle
17583 ? Ss 0:00 postgres: sisis sisis 10.23.33.19(49630) idle
17584 ? Ss 0:00 postgres: sisis sisis 10.23.33.19(49632) idle
17585 ? Ss 0:00 postgres: sisis sisis 10.23.33.19(49634) idle
17587 ? Ss 0:00 postgres: sisis sisis ::1(48762) idle
17590 ? Ss 0:00 postgres: sisis sisis ::1(48770) idle
17593 ? Ss 0:00 postgres: sisis sisis ::1(48778) idle
17609 ? Ss 0:04 postgres: sisis sisis ::1(48794) idle
17612 ? Ss 0:00 postgres: sisis sisis ::1(48802) idle
17615 ? Ss 0:04 postgres: sisis sisis ::1(48810) idle
17618 ? Ss 0:00 postgres: sisis sisis ::1(48818) idle
17621 ? Ss 0:08 postgres: sisis sisis ::1(48826) idle
17866 ? Ss 0:00 postgres: sisis sisis 10.23.33.19(49758) idle
17868 ? Ss 0:00 postgres: sisis sisis ::1(48886) idle
17907 ? Ss 0:00 postgres: sisis sisis ::1(48900) idle
17948 ? Ss 0:00 postgres: sisis sisis ::1(48914) idle
21457 ? Ss 0:00 postgres: sisis sisis ::1(53664) idle
23958 ? Ss 0:00 postgres: sisis sisis ::1(53742) idle
^^^^^

lsof -P -p 23957 | grep 5432
INDEX 23957 sisis 2u IPv6 117475261 0t0 TCP localhost:53742->localhost:5432 (ESTABLISHED)

--
Matthias Apitz, ✉ guru(at)unixarea(dot)de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
May, 9: Спаси́бо освободители! Thank you very much, Russian liberators!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2020-04-27 12:22:06 Re: How to debug "background worker "parallel worker" (PID 32152) was terminated by signal 11: Segmentation fault"
Previous Message Tom Lane 2020-04-27 12:20:06 Re: HOST variable in psql