Re: BUG #15448: server process (PID 22656) was terminated by exception 0xC0000005

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>
Cc: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, tillmann73(at)yahoo(dot)de, pgsql-bugs(at)lists(dot)postgresql(dot)org, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BUG #15448: server process (PID 22656) was terminated by exception 0xC0000005
Date: 2018-10-23 13:44:30
Message-ID: CA+HiwqFBUcjjqbnyVaAbUkPBV0+FigrqfL1h7D+3kB4VZxPe-Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Hi,

On Tue, Oct 23, 2018 at 8:46 PM Andrew Dunstan
<andrew(dot)dunstan(at)2ndquadrant(dot)com> wrote:
> On 10/22/2018 10:00 PM, Amit Langote wrote:
> > After observing the test case in the provided log, I managed to reproduce
> > it with the following:
> >
> > create table foo (a int primary key, b int);
> > create table bar (a int references foo on delete cascade, b int);
> > insert into foo values (1, 1);
> > insert into foo values (2, 2);
> > alter table foo add c int;
> > alter table foo drop c;
> > delete from foo;
> > server closed the connection unexpectedly
> > This probably means the server terminated abnormally
> > before or while processing the request.
> > The connection to the server was lost. Attempting reset: Failed.
> >
> > Analyzing this crash, I located the bug down to GetTupleForTrigger(), but
> > perhaps it's really in heap_expand_tuple() / expand_tuple(), where the
> > value of trigger tuple's t_self is being switched from a valid one to an
> > invalid value.
> >
> > In heaptuple.c: expand_tuple()
> >
> >
> > ItemPointerSetInvalid(&((*targetHeapTuple)->t_self));
> >
> >
> > FWIW, attached patch fixes this for me. Adding Andrew whose recent commit
> > 7636e5c60f [1] seems to have introduced the heap_expan_tuple call in
> > GetTupleForTrigger. Maybe, he can better judge a fix for this.
>
> Thanks. I think the line in expand_tuple is a thinko and we should
> change it, rather than change GetTupleForTrigger().

Agreed.

> Here is a patch that does that and also adds your test case to the
> regression tests.

Looks good.

Thanks,
Amit

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Ozan Kahramanogullari 2018-10-23 15:08:58 Re: psql on Mac
Previous Message Tom Lane 2018-10-23 12:21:31 Re: BUG #15449: file_fdw using program cause exit code error when using LIMIT

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-10-23 14:50:57 Re: Buildfarm failures for hash indexes: buffer leaks
Previous Message John Naylor 2018-10-23 13:42:02 Re: WIP: Avoid creation of the free space map for small tables