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