Re: Debugging initdb breakage

Lists: pgsql-hackers
From: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Debugging initdb breakage
Date: 2010-10-10 20:38:01
Message-ID: m2sk0deqc6.fsf@2ndQuadrant.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

So I'm beginning to work on the extension support for dump and restore,
and that begins with a new pg_extension catalog. I managed to break
initdb already, of course, but I'm fighting my way out — no luck with
gdb, it won't catch the Assert failure and show me a backtrace. I tried
"set follow-fork-mode child" in gdb, in different systems, to no avail.

Please find attached the detailed initdb.log and the very few items I
needed to obtain:

TRAP: FailedAssertion("!(reln->md_fd[forkNum] == ((void *)0))", File: "md.c", Line: 254)
child process was terminated by signal 6: Abort trap

How to have gdb help me? What's my error, that I guess is obvious? Where
do I read more now in order not to need too much assistance after that?

Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support

Attachment Content-Type Size
pg_extension.fail.patch text/x-patch 3.3 KB
initdb.log.gz application/zip 143.0 KB

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Debugging initdb breakage
Date: 2010-10-10 21:24:17
Message-ID: 4CB22F01.3030302@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 10.10.2010 23:38, Dimitri Fontaine wrote:
> So I'm beginning to work on the extension support for dump and restore,
> and that begins with a new pg_extension catalog. I managed to break
> initdb already, of course, but I'm fighting my way out — no luck with
> gdb, it won't catch the Assert failure and show me a backtrace. I tried
> "set follow-fork-mode child" in gdb, in different systems, to no avail.
>
> Please find attached the detailed initdb.log and the very few items I
> needed to obtain:
>
> TRAP: FailedAssertion("!(reln->md_fd[forkNum] == ((void *)0))", File: "md.c", Line: 254)
> child process was terminated by signal 6: Abort trap
>
> How to have gdb help me? What's my error, that I guess is obvious? Where
> do I read more now in order not to need too much assistance after that?

At least on my system, assertion failure creates a core dump that you
can load in gdb. Make sure you use "ulimit -c unlimited" or similar.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Debugging initdb breakage
Date: 2010-10-10 21:33:51
Message-ID: 17777.1286746431@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr> writes:
> How to have gdb help me? What's my error, that I guess is obvious?

Might have something to do with using the same OID for the catalog
and its index ...

regards, tom lane


From: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Debugging initdb breakage
Date: 2010-10-11 07:20:15
Message-ID: m2r5fxci1c.fsf@2ndQuadrant.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> Might have something to do with using the same OID for the catalog
> and its index ...

Ahah, that's how obvious it was, thank you. I feel ashamed, but at the
same time, thanks to your answer, it now feels like the week-end was a
good preparatory step for opening this week.

Back to producing cores (ulimit -c unlimited),
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Debugging initdb breakage
Date: 2010-10-12 14:51:58
Message-ID: 1286894990-sup-8190@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Excerpts from Dimitri Fontaine's message of dom oct 10 17:38:01 -0300 2010:
> Hi,
>
> So I'm beginning to work on the extension support for dump and restore,
> and that begins with a new pg_extension catalog. I managed to break
> initdb already, of course, but I'm fighting my way out — no luck with
> gdb, it won't catch the Assert failure and show me a backtrace. I tried
> "set follow-fork-mode child" in gdb, in different systems, to no avail.

As a note, I've had luck finding bootstrap-time bugs by manually feeding
the bootstrapping commands into bootstrap mode, with a leftover dir from
"initdb --noclean". This has helped a few times that there has been no
PANIC but just a FATAL or ERROR, for example. It's easy to attach GDB
to such a backend.

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


From: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Debugging initdb breakage
Date: 2010-10-12 20:05:57
Message-ID: m24ocr2n2y.fsf@2ndQuadrant.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> As a note, I've had luck finding bootstrap-time bugs by manually feeding
> the bootstrapping commands into bootstrap mode, with a leftover dir from
> "initdb --noclean". This has helped a few times that there has been no
> PANIC but just a FATAL or ERROR, for example. It's easy to attach GDB
> to such a backend.

Nice tip, thanks!
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support


From: David Fetter <david(at)fetter(dot)org>
To: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Debugging initdb breakage
Date: 2010-10-12 20:35:44
Message-ID: 20101012203544.GA16383@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Oct 12, 2010 at 10:05:57PM +0200, Dimitri Fontaine wrote:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> > As a note, I've had luck finding bootstrap-time bugs by manually
> > feeding the bootstrapping commands into bootstrap mode, with a
> > leftover dir from "initdb --noclean". This has helped a few times
> > that there has been no PANIC but just a FATAL or ERROR, for
> > example. It's easy to attach GDB to such a backend.
>
> Nice tip, thanks!

Where should we preserve this, other than the mailing list archives?

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


From: Greg Smith <greg(at)2ndquadrant(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Debugging initdb breakage
Date: 2010-10-18 02:15:36
Message-ID: 4CBBADC8.7050405@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

David Fetter wrote:
> Where should we preserve this, other than the mailing list archives?
>

http://wiki.postgresql.org/wiki/Getting_a_stack_trace_of_a_running_PostgreSQL_backend_on_Linux/BSD
has most of the other trivia in this area, so I just added Alvaro's
technique to the bottom of it with a quick intro to add some context.

--
Greg Smith, 2ndQuadrant US greg(at)2ndQuadrant(dot)com Baltimore, MD
PostgreSQL Training, Services and Support www.2ndQuadrant.us