Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XUHqQ-00080B-H8 for pgsql-bugs@arkaria.postgresql.org; Wed, 17 Sep 2014 16:12:38 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XUHqP-0000iY-FE for pgsql-bugs@arkaria.postgresql.org; Wed, 17 Sep 2014 16:12:37 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XUHqO-0000he-Eo for pgsql-bugs@postgresql.org; Wed, 17 Sep 2014 16:12:36 +0000 Received: from mout.kundenserver.de ([212.227.126.187]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XUHqK-0003pg-KI for pgsql-bugs@postgresql.org; Wed, 17 Sep 2014 16:12:34 +0000 Received: from anarazel.de (p5DDC6F53.dip0.t-ipconnect.de [93.220.111.83]) by mrelayeu.kundenserver.de (node=mreue001) with ESMTP (Nemesis) id 0Lo5wv-1XwSrF2wBN-00gFmx; Wed, 17 Sep 2014 18:12:28 +0200 Received: by anarazel.de (Postfix, from userid 1000) id C5112101986; Wed, 17 Sep 2014 18:12:27 +0200 (CEST) Date: Wed, 17 Sep 2014 18:12:27 +0200 From: Andres Freund To: alexk@hintbits.com Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #11444: autovacuum stuck for 5 days and waits on a lock Message-ID: <20140917161227.GS25887@awork2.anarazel.de> References: <20140917160216.2486.59930@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140917160216.2486.59930@wrigleys.postgresql.org> X-Provags-ID: V02:K0:4QN+pzJ+42LIfV35RS+Yr51U5Lthb3wkgClxIiKWyVv 7RQkL6OJP6xb9mHlQl8mihYYxzZgR+ZFkORXaR2v5bf0BtNV1Y rwilq6bl/4apm0wgrlRYowjqGZFNgQ0eiY+uJd682ERW5wY0S1 akILGi4JYGkj9GcZXRcUeus2+72Y4yOQBC8FCCaDVR8cS8P3Hv vveofdiazp/fE+6NSMown6AHvt7RYkNGDDtH2Lesj1nsR/TCWN bwhSkH8EryGeDPbPjeKXsX/ISmYR5yFiBLO64rmudWo3J7yzQ9 wINYNUdP6PkvBiR1fvfG92TSzVv8UR/StLRfIq4uI89HBwakRK F3YDEA1/Rqqg/VnfIkKOIYQb6HysXZmR4tAWDCgqL X-UI-Out-Filterresults: notjunk:1; X-Pg-Spam-Score: -2.1 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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