could not send data to client: Permission denied - Mailing list pgsql-general

From Daniel Jakots
Subject could not send data to client: Permission denied
Date
Msg-id 20200827111031.5ee46257@anegada
Whole thread Raw
Responses Re: could not send data to client: Permission denied
List pgsql-general
Hi,

I run a flask rest api which use postgres to store data. I've been
using it for a few months and it worked flawlessly. I recently got an
error twice (58h10m apart). I added a lot more data a few days ago which
could be the reason I get this now, but the table is still quite small
with 69807 lines. This endpoint is called by a handful of machines
every 5 minutes and it works all the time except those two times.

The API runs in docker with gunicorn.
[2020-08-27 02:10:03,624] ERROR in app: Exception on /v1/pf [GET]
Traceback (most recent call last):
[...]
  File "/home/snek/app/api/tools.py", line 94, in ip_get
    cursor.execute("SELECT ip FROM pf_ip_ban;")
psycopg2.OperationalError: server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.

In postgresql log, it says:
Aug 27 02:10:02 db1 postgres[62464]: [7-1] 10.10.10.43(41816):[unknown]@[unknown]: LOG:  connection received:
host=10.10.10.43port=4181
 
Aug 27 02:10:02 db1 postgres[62464]: [8-1] 10.10.10.43(41816):api@api: LOG:  connection authorized: user=api
database=api
Aug 27 02:10:02 db1 postgres[62464]: [9-1] 10.10.10.43(41816):api@api: LOG:  could not send data to client: Permission
denied
Aug 27 02:10:02 db1 postgres[62464]: [9-2] 10.10.10.43(41816):api@api: STATEMENT:  SELECT ip FROM pf_ip_ban;
Aug 27 02:10:02 db1 postgres[62464]: [10-1] 10.10.10.43(41816):api@api: FATAL:  connection to client lost
Aug 27 02:10:02 db1 postgres[62464]: [10-2] 10.10.10.43(41816):api@api: STATEMENT:  SELECT ip FROM pf_ip_ban;

Postgresql and the python code runs on two different VM, but
they're both on the same hypervisor (kvm on ubuntu). Therefore I would
assume the network between them should be uneventful; but software
has bugs.

Postgresql is postgresql-server-12.3p0 running OpenBSD -current.

I searched the error on the web but I didn't find anything with this
exact error. Do you know what could cause it? Or how could I get more
information?

I tuned OpenBSD according to our README:
https://github.com/openbsd/ports/blob/master/databases/postgresql/pkg/README-server#L59-L68
could it be that the values are too low since the table growth?

Cheers,
Daniel



pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Are advisory locks guaranteed to be First Come First Serve? And can the behavior be relied upon?
Next
From: "Fontana Daniel C \(Desartec S.R.L.\)"
Date:
Subject: Postgres and alias