pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Julien Rouhaud <rjuju123@gmail.com>
To: Josef Machytka <josef.machytka@gmail.com>
Cc: Postgres General <pgsql-general@postgresql.org>
Subject: Re: strange locks on PG 11 with Golang programs
Date: Mon, 9 Mar 2020 10:36:55 +0100
Message-ID: <20200309093655.GA39356@nol> (raw)
In-Reply-To: <CAGvVEFuPfVYLKJq=uzB_eLXfOwAjrM09HtVO5G6+6XcHi3hukQ@mail.gmail.com>
References: <CAGvVEFuDvpFfiH6ja_jvf5u-GfhoLPEom+adWESwHEXfRjKdBQ@mail.gmail.com>
	<20200309085829.GA34056@nol>
	<CAGvVEFuPfVYLKJq=uzB_eLXfOwAjrM09HtVO5G6+6XcHi3hukQ@mail.gmail.com>

On Mon, Mar 09, 2020 at 10:21:23AM +0100, Josef Machytka wrote:
> On Mon, 9 Mar 2020 at 09:58, Julien Rouhaud <rjuju123@gmail.com> wrote:
>
> > The query displayed is just the query currently executing, but if the
> > connection is in a transaction the problematic lock could have been
> > acquired by
> > any previously executed query.  Did you check in pg_stat_activity if the
> > connection is in a transaction (e.g. query_start != xact_start)?
>
> Oh, I see. Thank you. I modified query from wiki and it shows that blocking
> session actually runs for ~12 hours already. Only last COPY command started
> recently. So maybe golang library did not close session properly and reused
> it in another completely different task? Although I defer db.Close()
> everywhere...

I don't know anything about golang libraries, but this sounds like a problem of
a simulated non-autocommit mode in the driver/lib.  You should look at
transaction handling with the lib you're using.





view thread (6+ messages)  latest in thread

Message-ID: <20200309093655.GA39356@nol>
Permalink:  ../20200309093655.GA39356@nol/
Also on:    postgresql.org/message-id/20200309093655.GA39356@nol

 · 

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-general@postgresql.org
  Cc: rjuju123@gmail.com, josef.machytka@gmail.com
  Subject: Re: strange locks on PG 11 with Golang programs
  In-Reply-To: <20200309093655.GA39356@nol>
  References: <CAGvVEFuDvpFfiH6ja_jvf5u-GfhoLPEom+adWESwHEXfRjKdBQ@mail.gmail.com> <20200309085829.GA34056@nol> <CAGvVEFuPfVYLKJq=uzB_eLXfOwAjrM09HtVO5G6+6XcHi3hukQ@mail.gmail.com> <20200309093655.GA39356@nol>

* 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