Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W2Rg3-0006oA-9m for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Jan 2014 20:30:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W2Rg2-00034U-Kh for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Jan 2014 20:30:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W2Rg1-00034K-8H for pgsql-hackers@postgresql.org; Sun, 12 Jan 2014 20:30:33 +0000 Received: from mail-qc0-f170.google.com ([209.85.216.170]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W2Rfy-0001fi-9c for pgsql-hackers@postgresql.org; Sun, 12 Jan 2014 20:30:32 +0000 Received: by mail-qc0-f170.google.com with SMTP id e9so5725820qcy.1 for ; Sun, 12 Jan 2014 12:30:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=szEl3FBci22XdfVbeKakLmO7vfGcZhi0o2OO9QWTiJE=; b=Qwuwmt7grUR4MWY49nuIEOeciuxXAN+Mz/xFdY+JZMTeN0MdOMf9HHcWALtcMqHFyA 2DJrd4DzGTYZILqIyGMf0GWpkiRDoy7ktI7A95KIUQigOWDKqGfyKqc3XaHM5N83ussF rc7WXsDiq2Dud9p1xixN3dV78Dj9tPoyU4T43lnwNStj5ZxF/Y+bKSnXtifm1fYlhl5y AFjvmCoeVi8Tw2jUNJskZDxvc2GPVnozqHUaZnT2sXbng21dwRHI8xDe87Aia0Rf4srp QcmZAGwEO9lVfis1HZiocT5U7LMoGq9TY0pvy6xkanNxNqJaIWfiONSstPr9PD2FG1Fv gMnw== X-Gm-Message-State: ALoCoQkj70URCq2bhjNO2bZ6OmTga/2/pC0c/E+LM1YdMPvYlHOgcUweOBUoaWqLVNLZSYfyQd1V X-Received: by 10.49.25.137 with SMTP id c9mr17037662qeg.12.1389558628335; Sun, 12 Jan 2014 12:30:28 -0800 (PST) Received: from tornado.leadboat.com (c-107-4-219-91.hsd1.va.comcast.net. [107.4.219.91]) by mx.google.com with ESMTPSA id d16sm22106313qaw.1.2014.01.12.12.30.27 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 12 Jan 2014 12:30:28 -0800 (PST) Date: Sun, 12 Jan 2014 15:30:26 -0500 From: Noah Misch To: Tom Lane Cc: lcampbell@asascience.com, pgsql-bugs@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: BUG #8782: Segmentation Fault during initialization Message-ID: <20140112203026.GB1729862@tornado.leadboat.com> References: <21537.1389406247@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <21537.1389406247@sss.pgh.pa.us> User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org 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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers