Re: Assertion failure in syncrep.c

From: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Assertion failure in syncrep.c
Date: 2014-09-23 05:40:11
Message-ID: CABOikdMn_aoDFVYTYJGe-V-=iePfCK3Qu61YyO_Y=+vwdTOxvQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Sep 22, 2014 at 6:50 PM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:

> Pavan,
>
> * Pavan Deolasee (pavan(dot)deolasee(at)gmail(dot)com) wrote:
> > On Thu, Sep 18, 2014 at 12:02 PM, Pavan Deolasee <
> pavan(dot)deolasee(at)gmail(dot)com>
> > wrote:
> > > While running some tests on REL9_2_STABLE branch, I saw an assertion
> > > failure in syncrep.c. The stack trace looks like this:
> > >
> > Any comments on this? I see it very regularly during my pgbench tests.
>
> I agree that it looks like there may be a race condition there- but
> could you provide the test cases you're working with? What kind of
> behavior is it that's making it show up easily for you?
>
>
Nothing special really. Set up a 2-node sync replication on my Mac laptop
and running pgbench with 10 clients triggers it. As I said, after looking
at the code and realising that there is a race condition, I tried with with
gdb to reproduce the race I suspect.

Anyways, the attached patch should trigger the race condition for a simple
query. I'm deliberately making backend to wait to give walsender a chance
to send outstanding WALs and then making walsender to wait so that
assertion is triggered in the backend.

Hope this helps.

Thanks,
Pavan
--
Pavan Deolasee
http://www.linkedin.com/in/pavandeolasee

Attachment Content-Type Size
syncrep_assertion_trigger.patch application/octet-stream 1004 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2014-09-23 05:45:06 tick buildfarm failure
Previous Message Tom Lane 2014-09-23 05:30:03 Re: proposal: rounding up time value less than its unit.