Re: BUG #8782: Segmentation Fault during initialization

From: Noah Misch <noah(at)leadboat(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: lcampbell(at)asascience(dot)com, pgsql-bugs(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: BUG #8782: Segmentation Fault during initialization
Date: 2014-01-12 20:30:26
Message-ID: 20140112203026.GB1729862@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Fri, Jan 10, 2014 at 09:10:47PM -0500, Tom Lane wrote:
> 3. Move the MemoryContextInit() call to before set_pglocale_pgservice().

> #3 is not too nice either, because it would mean calling MemoryContextInit
> in main.c which doesn't seem like a great place for it. On the other
> hand, there is a whole lot of rather random junk getting called from
> main.c; who wants to bet that none of the rest of it can call elog(),
> either now or in the future?
>
> After a few moments' thought, I lean a bit towards #3, but it's a
> weakly held position. Anyone have other ideas?

I, too, would pick #3. Not much has reason to run before MemoryContextInit();
the only candidate that comes to mind is pgwin32_install_crashdump_handler().

> One other point here is that I'm pretty sure MemoryContextInit itself
> will try to elog() if it fails. I don't know if it's worth trying
> to unwind that circularity. As long as we do it early enough, the
> odds of failure should be about negligible --- certainly I don't
> recall ever seeing a report of a crash there.
>
> Possibly it'd be worth having some check in elog.c that ErrorContext has
> been created, with a very simple "print some fixed text to stderr and die"
> behavior if not. That would at least be more useful than a bare crash.

Not sure about what more to do here.

Thanks,
nm

--
Noah Misch
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Martin Junek 2014-01-13 01:40:21 Re: BUG #8771: Query execution plan broken after upgrade from 9.1.9
Previous Message Martin Junek 2014-01-12 19:58:59 Re: BUG #8771: Query execution plan broken after upgrade from 9.1.9

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2014-01-12 20:35:12 Re: Standalone synchronous master
Previous Message Josh Berkus 2014-01-12 19:59:43 Re: Standalone synchronous master