agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Álvaro Herrera <alvherre@kurilemu.de>
To: Bryan Green <dbryan.green@gmail.com>
Cc: Euler Taveira <euler@eulerto.com>
Cc: Jakub Wartak <jakub.wartak@enterprisedb.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: [PATCH] Add Windows support for backtrace_functions (MSVC only)
Date: Mon, 23 Feb 2026 23:07:47 +0100
Message-ID: <202602232201.2d5ez5tbrkg2@alvherre.pgsql> (raw)
In-Reply-To: <6dea1cfa-1efd-41cb-8d1e-ad35d4304aa3@gmail.com>

On 2026-Feb-23, Bryan Green wrote:

> I have implemented DuplicateHandle and closed the handle in the
> appropriate places.  I also reset backtrace_process to NULL if
> SymInitialize() fails.  Patch is attached.

Hmm, should then backtrace_cleanup() cope with the case where it's NULL?

Also, I wonder what happens if one "backtraceable" error occurs, and we
fail to SymInitialize(), then another backtraceable error occurs.
Should we do the DuplicateHandle()+SymInitialize() dance again, or
should we just give up?  The current implementation does the former, I
think; but the latter is also easily achievable by setting
backtrace_symbols_initialized to true and leaving backtrace_process as
NULL; then this case can be detected specifically in set_backtrace() and
treated as a case where we just return NULL before attempting anything
else.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/





view thread (36+ messages)  latest in thread

Message-ID: <202602232201.2d5ez5tbrkg2@alvherre.pgsql>
Permalink:  ../202602232201.2d5ez5tbrkg2@alvherre.pgsql/
Also on:    postgresql.org/message-id/202602232201.2d5ez5tbrkg2@alvherre.pgsql

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@kurilemu.de, dbryan.green@gmail.com, euler@eulerto.com, jakub.wartak@enterprisedb.com, michael@paquier.xyz
  Subject: Re: [PATCH] Add Windows support for backtrace_functions (MSVC only)
  In-Reply-To: <202602232201.2d5ez5tbrkg2@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox