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.96) (envelope-from ) id 1vucbZ-00GF3l-1t for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Feb 2026 20:32:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vucbY-00FClA-1e for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Feb 2026 20:32:32 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vucbY-00FCkt-0j for pgsql-hackers@lists.postgresql.org; Mon, 23 Feb 2026 20:32:32 +0000 Received: from mail-yw1-x1134.google.com ([2607:f8b0:4864:20::1134]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vucbV-00000000qrU-1IR3 for pgsql-hackers@postgresql.org; Mon, 23 Feb 2026 20:32:31 +0000 Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-797de0727a4so42934327b3.0 for ; Mon, 23 Feb 2026 12:32:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771878750; x=1772483550; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=iIgkovglzcYTPvq+bPOgwZAkQ4HFaHVGvPsjcLzFlHY=; b=mZzFRJV/i+alpdHDNlR4oTcfrCoAb5CE7AZbYjE5rQBbvGeFYZNMs6tvSRWBR8X3Ai IydLZJCokwNNAovngaSsINTEuKtxnJl1P/g06I/AIZ/j4BG2fo+dHIGseUZhSqbW+iWN 5E0E4CcHpDl36bXy0TyyXUXGx1OLrIZLfjACqX957bwLAFQsHL3M++l+ZRGBDdFbX3q8 Jyszzyz0hWKzoEjbzL2Wb5JoIQYmTZhSWMfubkY/IUFomqxg7l0+5mY9RIjpJLgePFTl AneVEPAVT1K1g706RX9BMCruEKlUE1kBhPgOERdAZsLYA0f5LUF4H0HRG5grRWW7bRqO oOUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771878750; x=1772483550; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=iIgkovglzcYTPvq+bPOgwZAkQ4HFaHVGvPsjcLzFlHY=; b=ADFnmxaDGHubi5m0f99UEy0LoZOgz5LHoWRJ5hW1UOpisus45cCPkFe1P4Ix3SQPJr zR1z3+Z5r+VEwx6MItULhmA/fUX0kdFP/ToV820YKg+/zNQpi0y2WZiqPnfZFY+jIY0Z kdBb6L7meE69eRTluSOZ8GQDB6MyuST9MnAKIRpQsLB7taAK+qSlg308071MLKpYwqfJ utyQR9dHTYH2MDkF+E1ZupAHBLjOviu7uF2JacznrT/nNdCnfC9Ib+iRsdP+M03GY5wW I5ConA+pFR/wIFbVAIkwBMnFox5Dn25ma2zVcuVZNoWg3lCbqYNUhY4BjIZlHmljSxFC VkjQ== X-Forwarded-Encrypted: i=1; AJvYcCWc4aOaBs1qfDDXc9bAzjKz/B2UgrcCAcSgCzX5bxYuQTnQrIqkq6bzBbZhkWvFiTeE/xxeAFpXziqqCebF@postgresql.org X-Gm-Message-State: AOJu0YwKFCgM54V/az8Ia31EYFkLzctrJDwXDT7FKrii70+JqO3Fk6/Y w2AaNmPL6oeM8PEqlBnYLDgpkfJhGlwBDvd09bIm3gOBUe6GLiosSBW+ X-Gm-Gg: ATEYQzzTpmL9UTnu3Vl3d5VBeVvxxzKKOU+ECDhX46E/JhUflhADW76rC3wpzqnjkTt MjbbZcj/zgkuLBCenkKpaoppwrvoEzVkLllVTC1k9pMPBbT1VKUINBTbtlYYdOlJdjIqGPWa0oV W8FGzGOI1Bp4YofOrKKeNpZTYoAZ+e7ruOkmrhyQXVY8Pr47Os7vuS+DfDkpHSrWWmTkqM4J/hL sPvVi8UX5cD1bEQPkfBZIr3btu32E56ddz3Th2yipwH2ZlUV4UQyxlJUvclgQ7xQ/b9S1jono+u ZcvBXMrZBdMmOu6YYVxwWtEqhlI0rgfuPBRE9IIjIc+AcCDEV5YRS9D7yyZy16XJzcaXdGFKSTt WbEj5TOfbrMCAtHKS7pQrcCrE9bWxqR05yjHs0zvpDB7qnJ1Bq3kg38WWXhNnV2phdY5gOQtoRn iKzmi3SOR/H9C3zZYkzBSCcGzdvOOtwgDumg2lwMnO1Ne3IthMWyY7jLXUz78Fb8V/CaoguYj63 Sz2iUGlUa7eTRYwDz/oT9ZIuxHa/NZIW1f0 X-Received: by 2002:a05:690c:6604:b0:797:db54:b856 with SMTP id 00721157ae682-79828fc1d5emr101998857b3.35.1771878749183; Mon, 23 Feb 2026 12:32:29 -0800 (PST) Received: from ?IPV6:2600:1700:8952:80:e08a:9894:2f23:ace1? ([2600:1700:8952:80:e08a:9894:2f23:ace1]) by smtp.gmail.com with ESMTPSA id 00721157ae682-7982db8f922sm36492507b3.3.2026.02.23.12.32.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Feb 2026 12:32:28 -0800 (PST) Message-ID: <00e2f579-99d8-4b80-94c0-745612ac2ff5@gmail.com> Date: Mon, 23 Feb 2026 14:31:34 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Add Windows support for backtrace_functions (MSVC only) To: =?UTF-8?Q?=C3=81lvaro_Herrera?= Cc: Euler Taveira , Jakub Wartak , Michael Paquier , pgsql-hackers References: <202602232005.2cmbj5ougsfv@alvherre.pgsql> Content-Language: en-US From: Bryan Green In-Reply-To: <202602232005.2cmbj5ougsfv@alvherre.pgsql> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2/23/2026 2:16 PM, Álvaro Herrera wrote: > Hello, thanks for following up. > > However, I was going over the commit message one final time after your > reply, and I noticed that SymInitialize()'s documentation says quite > explicitly: > > "Do not use the handle returned by GetCurrentProcess" > https://learn.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-syminitialize > > which is exactly what we do with this patch. > > I think we should DuplicateHandle() on the GetCurrentProcess() handle > (which then obviously needs CloseHandle afterwards). Would you agree? > > Here's the whole thing again with edited commit message and some trivial > stylistic changes. > > > I was amused to discover that Solaris, macOS and FreeBSD all copied the > backtrace() interface from glibc, and the only platform in the buildfarm > other than Windows that seems to lack support for backtraces is Alpine > Linux. > > Regards > Ouch. Can't believe I missed that. Yeah, that is a no go. We could use openprocess with the getcurrentprocessid. Let me look this over. And yes, regardless of which way we do it we will need a CloseHandle. -- Bryan Green EDB: https://www.enterprisedb.com