Re:

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "'Bruno Hass de Andrade *EXTERN*'" <brunohass2303(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re:
Date: 2015-06-24 07:51:57
Message-ID: A737B7A37273E048B164557ADEF4A58B50F6808A@ntex2010a.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

  • at 2015-06-23 17:58:58 from Bruno Hass de Andrade

Browse pgsql-general by date

  From Date Subject
Next Message Andomar 2015-06-24 09:01:47 Include.d and warnings
Previous Message litu16 2015-06-24 06:20:42 INSERT a real number in a column based on other columns OLD INSERTs