Re: postgresql hanging/stuck

From: Andres Freund <andres(at)anarazel(dot)de>
To: Andrzej Pilacik <cypisek77(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: postgresql hanging/stuck
Date: 2017-03-14 20:55:24
Message-ID: 20170314205524.u24xthif5tk3t2ef@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On 2017-03-14 16:47:40 -0400, Andrzej Pilacik wrote:
> Since then we had 2 incidents where PostgreSQL connections went to about
> 300 and PostgreSQL became unresponsive and restarted itself.

Could you give a bit more details about how that "retarted itself"
happened? Any chance you saw something about a "stuck spinlock" in the
logs?

> We have monitors setup to page us when connections are over 250.
> PostgreSQL should still have about 250 connections available.
>
> When this occurred, we saw a lot of connections in the authentication state
> (stuck)
>
> *They all looked like: postgres: username databasename ipaddress (pid)
> authentication*

The symptoms suggest you're hitting quite massive lock contention. But
that's just a guess, not yet enough information to nail that down. If
that's the case, a update to 9.6 might resolve the issue, we've done two
significant scalability improvements that could affect your case.

> During the incident (about 10-15min timeline)
>
> - CPUs are running high but the box is still very responsible. 60-70%
>
> - Memory allocations are ok, no paging. Nothing looks out of norm.

Have you checked that you're not running into issues with transparent
hugepages? The symptoms don't quite match, but it's still useful to make
sure. I don't know which kernel / distribution you're running, but a
search for "disable transparent hugepages $distro" should help.

> - We have our normal scenario engine running with about 30-40 active
> connections + some 5-10 active reporting and processing connections at a
> time (lots of quick/short queries)

Is there a chance you could provide a profile using perf? See
https://wiki.postgresql.org/wiki/Profiling_with_perf

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2017-03-15 06:28:03 Re: Backend crash on non-exclusive backup cancel
Previous Message Andrzej Pilacik 2017-03-14 20:47:40 postgresql hanging/stuck