pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Chris Hanks <christopher.m.hanks@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Connections hang indefinitely while taking a LWLockTranche buffer_content lock.
Date: Mon, 23 Oct 2017 12:49:06 -0400
Message-ID: <6025.1508777346@sss.pgh.pa.us> (raw)
In-Reply-To: <CAK7KUdBPYO7G=dMaU-uJQM=tGkF6yPVwEf9L7s7ak_TfZ1=B0w@mail.gmail.com>
References: <CAK7KUdBjF4TN5Z2Rf0fv1MVUa=uqQssKMhoTXUa2y88R4PPjsg@mail.gmail.com>
	<27210.1508697596@sss.pgh.pa.us>
	<CAK7KUdCg0PWw2hMUOJkY6Z9JUu2gJEiC-YkJSBuSZPEHbSWn-Q@mail.gmail.com>
	<CAK7KUdBPYO7G=dMaU-uJQM=tGkF6yPVwEf9L7s7ak_TfZ1=B0w@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Chris Hanks <christopher.m.hanks@gmail.com> writes:
> Backtrace of query with PID 22:

> #0  0x00007fa23544ed87 in write_call_graph (fd=<optimized out>) at gmon.c:287
> #1  write_gmon () at gmon.c:394
> #2  0x00005639548bf72b in LWLockAcquire (lock=0xffff0001,
> mode=LW_EXCLUSIVE) at
> /build/postgresql-9.6-HEXeEe/postgresql-9.6-9.6.1/build/../src/backend/storage/lmgr/lwlock.c:1287
> #3  0x00005639546707c1 in ginHeapTupleFastInsert
> (ginstate=ginstate@entry=0x7ffef442af00,
> collector=collector@entry=0x7ffef442aee0)
>     at /build/postgresql-9.6-HEXeEe/postgresql-9.6-9.6.1/build/../src/backend/access/gin/ginfast.c:314

> Backtrace of query with PID 16987

> #0  0x00007fa23544ed87 in write_call_graph (fd=<optimized out>) at gmon.c:287
> #1  write_gmon () at gmon.c:394
> #2  0x00005639548bf72b in LWLockAcquire (lock=0xffff000f,
> mode=LW_EXCLUSIVE) at
> /build/postgresql-9.6-HEXeEe/postgresql-9.6-9.6.1/build/../src/backend/storage/lmgr/lwlock.c:1287
> #3  0x00005639546704e0 in ginHeapTupleFastInsert
> (ginstate=ginstate@entry=0x7ffef442af00,
> collector=collector@entry=0x7ffef442aee0)


So it looks like ginHeapTupleFastInsert is doing something that carries a
risk of deadlocking on two or more LWLocks, if multiple processes try to
insert index entries concurrently.  There's no deadlock detection in the
LWLock infrastructure --- that's one of the things that makes it
"lightweight" locks --- so callers have to avoid such coding patterns.

This is probably enough info for us to identify the exact cause.  But
I don't have time to look right this minute, and am not the hacker most
familiar with the GIN infrastructure anyway.  Anyone want to look for
the bug?

			regards, tom lane


-- 
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 (10+ messages)  latest in thread

Message-ID: <6025.1508777346@sss.pgh.pa.us>
Permalink:  ../6025.1508777346@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/6025.1508777346@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, christopher.m.hanks@gmail.com
  Subject: Re: Connections hang indefinitely while taking a LWLockTranche buffer_content lock.
  In-Reply-To: <6025.1508777346@sss.pgh.pa.us>
  References: <CAK7KUdBjF4TN5Z2Rf0fv1MVUa=uqQssKMhoTXUa2y88R4PPjsg@mail.gmail.com> <27210.1508697596@sss.pgh.pa.us> <CAK7KUdCg0PWw2hMUOJkY6Z9JUu2gJEiC-YkJSBuSZPEHbSWn-Q@mail.gmail.com> <CAK7KUdBPYO7G=dMaU-uJQM=tGkF6yPVwEf9L7s7ak_TfZ1=B0w@mail.gmail.com> <6025.1508777346@sss.pgh.pa.us>

* 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