Re: - Mailing list pgsql-general

From Albe Laurenz
Subject Re:
Date
Msg-id A737B7A37273E048B164557ADEF4A58B50F6808A@ntex2010a.host.magwien.gv.at
Whole thread Raw
In response to  (Bruno Hass de Andrade <brunohass2303@gmail.com>)
List pgsql-general
Bruno Hass de Andrade wrote:
> Hi. My company have servers that run postgres for storing some logs and serving django web interfaces
> for management of the server itself. In the last days some servers stopped serving the web interface,
> and syslog show this error:
> 
>     Jun 23 04:40:19 django-1 postgres[8790]: [3-1] FATAL:  remaining connection slots are reserved
> for non-replication superuser connections
> 
> So I started looking for the cause:

[...]

> 50 connections in idle status, but looking further:
> 
> 
>     $ cat /proc/4521/stack
>     [<ffffffff81b59a8a>] unix_stream_recvmsg+0x2b9/0x633
>     [<ffffffff81acbf27>] __sock_recvmsg_nosec+0x29/0x2b
>     [<ffffffff81ace30c>] sock_recvmsg+0x65/0x88
>     [<ffffffff81ace409>] SYSC_recvfrom+0xda/0x134
>     [<ffffffff81acf4ef>] SyS_recvfrom+0x9/0xb
>     [<ffffffff81bd4062>] system_call_fastpath+0x16/0x1b
>     [<ffffffffffffffff>] 0xffffffffffffffff
> 
> 
> All connections have stucked in this stack.

That just means that they are idle an waiting to receive a message from the client.

[...]

>     # postgresql.conf #
[...]
>     max_connections = 50

[...]

> I really don't know what is happening, why postgres hang and didn't close the connections. This django
> web interface is used only for management and viewing logs, most server have two users only.

The problem is clear from the PostgreSQL side:
You have reached the connection limit an so receive errors when you start new connections.

You'll have to investigate your application server why it starts so many connections
or why it fails to close idle connections after some time.
Is there a connection pool? How is it configured?

Yours,
Laurenz Albe

pgsql-general by date:

Previous
From: Suresh Raja
Date:
Subject: Re: Run analyze on schema
Next
From: Andomar
Date:
Subject: Include.d and warnings