Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rTJe8-001thC-AE for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Jan 2024 10:41:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rTJe7-00DUGx-BJ for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Jan 2024 10:41:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rTJe5-00DUGa-Os for pgsql-hackers@lists.postgresql.org; Fri, 26 Jan 2024 10:41:15 +0000 Received: from fhigh1-smtp.messagingengine.com ([103.168.172.152]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rTJe1-003oGN-VD for pgsql-hackers@lists.postgresql.org; Fri, 26 Jan 2024 10:41:13 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 936071140071; Fri, 26 Jan 2024 05:41:07 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 26 Jan 2024 05:41:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1706265667; x= 1706352067; bh=fFvjvOJn7h5yui3KYIblWCW1SIaGB4ZueYy0KWbtNd0=; b=G is1BVi6AmaohEVdAag9vOB7BFz85DItnu+1mmVX5fuaWsOZJFtL9DE0+2E+AllcD D65AX/ouBPHD7s94UuWy5W78gQAjtwnuFxqGuqtedhOGpJrmnhweFHVzCHUB3vQf as4G2kKqiCIf9BocfOdz6lYpZVeVgaSCY4z9Yd6kVtAlLeHuiumj44v2kCLh7Z6f S9FVcFyTZQShAHLJV3HCnfFa3x4CWoDfRN3K3FXe0I8RGHbW3rOuQ0De/he9yTmE Accl9PZ8eWAMXcjNcocSgum+3REYj//t58xva0dTfTjmoa8k/VToJYvuz98ugaw2 K+izCeMN3jq3rJejS+VcQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdeljedgudekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 26 Jan 2024 05:41:06 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1706265664; bh=h9I3q5/ShRMc090w8P3ru3AXGJWkSg/59JF6uMjphrA=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=AHQa4asrT0rRi2vS2oL/gMGQ0XMqhOQ3+SWIdLV0Mq16pbX1zmIUpRhNOBBNA5oah kwliyFAKd59a04sIcQpDiuB1orJxCWTnf8ThgyrZbBZ86ngEIr0EGMMi2v0p1zETfZ pceaA83dMrVABGqAJe3wxZto0EAPWD1SW70/oNmshR9yh3pNX+qcYAFRIYzFP+hVnD suWEtqpPsxDbMORsIXpE8S03CKopgmYmMZ7ry3Tmq7WsHu+CGF3CXFg1FPcgEUopCt oCTJ2P+LsuPQTJztuRf5ofIH/rBXGWOHrGRFh1/iZtTzL2Ex/DXrYu7l6Eg3qe9n5D aZyyk5957mirQ== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id B569F9B0; Fri, 26 Jan 2024 11:41:04 +0100 (CET) Date: Fri, 26 Jan 2024 11:41:04 +0100 From: Alvaro Herrera To: vignesh C Cc: Bharath Rupireddy , torikoshia , PostgreSQL Hackers Subject: Re: Printing backtrace of postgres processes Message-ID: <202401261041.tnf6wsga2zvm@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2022-Jan-27, vignesh C wrote: > diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml > index 0ee6974f1c..855ccc8902 100644 > --- a/doc/src/sgml/func.sgml > +++ b/doc/src/sgml/func.sgml > + You can get the file name and line number from the logged details by using > + gdb/addr2line in linux platforms (users must ensure gdb/addr2line is > + already installed). This doesn't read great. I mean, what is gdb/addr2line? I think you mean either GDB or addr2line; this could be clearer. > diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c > index 7402696986..522a525741 100644 > --- a/src/backend/utils/error/elog.c > +++ b/src/backend/utils/error/elog.c > @@ -944,9 +943,10 @@ errbacktrace(void) > * Compute backtrace data and add it to the supplied ErrorData. num_skip > * specifies how many inner frames to skip. Use this to avoid showing the > * internal backtrace support functions in the backtrace. This requires that > - * this and related functions are not inlined. > + * this and related functions are not inlined. If the edata pointer is valid, > + * backtrace information will be set in edata. > */ > -static void > +void > set_backtrace(ErrorData *edata, int num_skip) > { > StringInfoData errtrace; This seems like a terrible API choice, and the comment change is no good. I suggest you need to create a function that deals only with a StringInfo, maybe append_backtrace(StringInfo buf, int num_skip) which is used by set_backtrace to print the backtrace in edata->backtrace, and a new function log_backtrace() that does the ereport(LOG_SERVER_ONLY) thing. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "Before you were born your parents weren't as boring as they are now. They got that way paying your bills, cleaning up your room and listening to you tell them how idealistic you are." -- Charles J. Sykes' advice to teenagers