Re: Current CVS tip segfaulting

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Current CVS tip segfaulting
Date: 2004-05-01 17:04:35
Message-ID: 20040501170435.GC2333@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Apr 30, 2004 at 11:36:36PM -0400, Tom Lane wrote:
> Alvaro Herrera Munoz <alvherre(at)dcc(dot)uchile(dot)cl> writes:
> > strace'ing the postmaster suggested me that the dbname string in
> > utils/init/postinit.c, the InitPostgres function, is the culprit.
> > In fact, if I apply the following patch to tcop/postgres.c the
> > whole thing stops happening.
>
> > else if (argc - optind == 1)
> > ! dbname = argv[optind];
> > ...
> > else if (argc - optind == 1)
> > ! dbname = pstrdup(argv[optind]);
>
> Surely this is a red herring --- that code path does not even execute
> except in the case of a standalone backend.

Yes, I figured that out later (the normal path uses -p instead). In
fact I then took out the pstrdup() and the fault wasn't happening; so I
recompiled all over again, without the pstrdup and it was back.

I think maybe there's something clobbering argv. I thought about
tracing that with gdb but never got to it. I will do that now and
report back.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"El miedo atento y previsor es la madre de la seguridad" (E. Burke)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2004-05-01 17:20:47 Re: Weird prepared stmt behavior
Previous Message Joe Conway 2004-05-01 16:39:37 Re: Plan for feature freeze?