Re: PQConsumeinput stuck on recv

From: Andre Oliveira Freitas <afreitas(at)callixbrasil(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PQConsumeinput stuck on recv
Date: 2018-03-01 22:20:04
Message-ID: CAN6ijTAomqFVZD1r+oWOnQUnMZWfA7iskzsMWmvOmkBvTdu3Xg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I was able to capture the backtrace again, now with libpq debugging symbols.

Thread 15 (Thread 0x7f8cec068700 (LWP 68)):
#0 0x00007f8d252a1d9b in __libc_recv (fd=150, buf=0x7f8cf0034410,
n=16384, flags=623517083, flags(at)entry=0) at
../sysdeps/unix/sysv/linux/x86_64/recv.c:33
#1 0x00007f8d26689783 in recv (__flags=0, __n=<optimized out>,
__buf=<optimized out>, __fd=<optimized out>) at
/usr/include/x86_64-linux-gnu/bits/socket2.h:44
#2 pqsecure_raw_read (conn=conn(at)entry=0x7f8cf001e390, ptr=<optimized
out>, len=<optimized out>) at
/build/postgresql-10-rIfDLC/postgresql-10-10.2/build/../src/interfaces/libpq/fe-secure.c:230
#3 0x00007f8d26689863 in pqsecure_read
(conn=conn(at)entry=0x7f8cf001e390, ptr=<optimized out>, len=<optimized
out>) at /build/postgresql-10-rIfDLC/postgresql-10-10.2/build/../src/interfaces/libpq/fe-secure.c:217
#4 0x00007f8d266810ea in pqReadData (conn=conn(at)entry=0x7f8cf001e390)
at /build/postgresql-10-rIfDLC/postgresql-10-10.2/build/../src/interfaces/libpq/fe-misc.c:683
#5 0x00007f8d2667e6f2 in PQconsumeInput (conn=0x7f8cf001e390) at
/build/postgresql-10-rIfDLC/postgresql-10-10.2/build/../src/interfaces/libpq/fe-exec.c:1704

In this case, I also checked the pg_stat_activity and this particular
connection on pg server side was idle for 15 minutes. I killed it
using pg_terminate_backend, and then somehow the application resumed
execution.

As you can see, recv has received a non-zero value in flags, which has
the MSG_WAITALL bit is set, however in this case the application
expects the read to be non-blocking.

Thanks in advance,

André Freitas

2018-02-23 16:10 GMT-03:00 Andres Freund <andres(at)anarazel(dot)de>:
> Hi,
>
> On 2018-02-23 15:59:18 -0300, Andre Oliveira Freitas wrote:
>> I'm using the libpq that comes with debian, however I can install the
>> library from the official repository to be sure, I assume the one from
>> the official repo has it enabled.
>
> That should be fine. Could you get the backtrace again, after installing
> debugging symbols? It'd certainly be helpful to see the exact path to
> the blocking syscall.
>
> Greetings,
>
> Andres Freund

--

André Luis O. Freitas
System Architect

Rua do Rócio, 220 - Cj. 72
São Paulo - SP - 04552-000
55 11 4063 4222

afreitas(at)callix(dot)com(dot)br
www.callix.com.br

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tony Sullivan 2018-03-01 22:28:51 How to perform PITR when all of the logs won't fit on the drive
Previous Message marcelo 2018-03-01 22:06:43 Re: Enforce primary key on every table during dev?