pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@2ndquadrant.com>
To: alexk@hintbits.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #11444: autovacuum stuck for 5 days and waits on a lock
Date: Wed, 17 Sep 2014 18:12:27 +0200
Message-ID: <20140917161227.GS25887@awork2.anarazel.de> (raw)
In-Reply-To: <20140917160216.2486.59930@wrigleys.postgresql.org>
References: <20140917160216.2486.59930@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Hi,

On 2014-09-17 16:02:16 +0000, alexk@hintbits.com wrote:
> We've got a problem with autovacuum process running for already 5 days,
> without being blocked by any particular process.
> The table in question is around 500MB. Usually we don't see vacuums running
> there for more than couple of hours.
> Other autovacuum processes (on different tables) start and finish without
> issues.
> 
> The vacuum and autovacuum settings are left at default values. We don't have
> debug information compiled on this server, but here's what we have after the
> gdb bt output, attaching to the autovacuum process.

> #0  0x00007f423cbf34f7 in semop () from /lib/x86_64-linux-gnu/libc.so.6
> #1  0x00007f423e8581f8 in PGSemaphoreLock ()
> #2  0x00007f423e889a45 in LockBufferForCleanup ()
> #3  0x00007f423e6d9cd6 in ?? ()
> #4  0x00007f423e6da08f in ?? ()
> #5  0x00007f423e6daaf6 in btbulkdelete ()

What is happening here is that vacuum (of a btree index) is waiting for a so called
'cleanup' lock on a page. That is it waits for the page not being pinned
by any other backend.

> semop(2523174, {{12, -1, 0}}, 1
> semop(2523174, {{12, -1, 0}}, 1
> 
> 
> )        = 0
> lseek(21, 0, SEEK_END)                  = 32276480
> select(0, NULL, NULL, NULL, {0, 21000}) = 0 (Timeout)
> semop(2523174, {{12, -1, 0}}, 1
> 
> Most of the time it is stuck with semop.

That indicates it's waiting most of the time. But it does make progress.

> There are also UPDATE statements constantly running on this table, in the
> overlapping manner, so at a single moment there is at least one update
> running on it. We are investigating why is it done this way, but can it be a
> reason behind this strange vacuum behavior?

Which quite possibly is caused by this.


I've recently commented on -hackers that this is a very hard to debug
behaviour and should be made more visible, but IIRC we didn't come to a
conclusion...

Greetings,

Andres Freund

-- 
 Andres Freund	                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (3+ messages)  latest in thread

Message-ID: <20140917161227.GS25887@awork2.anarazel.de>
Permalink:  ../20140917161227.GS25887@awork2.anarazel.de/
Also on:    postgresql.org/message-id/20140917161227.GS25887@awork2.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: andres@2ndquadrant.com, alexk@hintbits.com
  Subject: Re: BUG #11444: autovacuum stuck for 5 days and waits on a lock
  In-Reply-To: <20140917161227.GS25887@awork2.anarazel.de>
  References: <20140917160216.2486.59930@wrigleys.postgresql.org> <20140917161227.GS25887@awork2.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox