Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kjwr9-0002B7-Ul for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Dec 2020 04:01:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kjwr7-0005fG-Ct for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Dec 2020 04:01:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kjwr7-0005f9-6R for pgsql-hackers@lists.postgresql.org; Tue, 01 Dec 2020 04:01:33 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kjwr3-0001jF-E2 for pgsql-hackers@lists.postgresql.org; Tue, 01 Dec 2020 04:01:32 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 0B141Puo1361751; Mon, 30 Nov 2020 23:01:25 -0500 From: Tom Lane To: Andres Freund cc: vignesh C , PostgreSQL Hackers Subject: Re: Printing backtrace of postgres processes In-reply-to: <20201201032649.aekv5b5dicvmovf4@alap3.anarazel.de> References: <1778088.1606026308@sss.pgh.pa.us> <20201201032649.aekv5b5dicvmovf4@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Mon, 30 Nov 2020 19:26:49 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1361749.1606795285.1@sss.pgh.pa.us> Date: Mon, 30 Nov 2020 23:01:25 -0500 Message-ID: <1361750.1606795285@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > It should be quite doable to emit such backtraces directly to stderr, > instead of using appendStringInfoString()/elog(). No, please no. (1) On lots of logging setups (think syslog), anything that goes to stderr is just going to wind up in the bit bucket. I realize that we have that issue already for memory context dumps on OOM errors, but that doesn't make it a good thing. (2) You couldn't really write "to stderr", only to fileno(stderr), creating issues about interleaving of the output with regular stderr output. For instance it's quite likely that the backtrace would appear before stderr output that had actually been emitted earlier, which'd be tremendously confusing. (3) This isn't going to do anything good for my concerns about interleaved output from different processes, either. regards, tom lane