pltcl crash on recent macOS

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: pltcl crash on recent macOS
Date: 2022-06-13 06:53:36
Message-ID: a78c847a-4f79-9286-be99-e819e9e4139e@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

A little while ago, the pltcl tests starting crashing for me on macOS.
I don't know what had changed, but I suspect it was either an operating
system update or something like an xcode update.

Here is a backtrace:

* frame #0: 0x00007ff7b0e61853
frame #1: 0x00007ff803a28751 libsystem_c.dylib`hash_search + 215
frame #2: 0x0000000110357700
pltcl.so`compile_pltcl_function(fn_oid=16418, tgreloid=0,
is_event_trigger=false, pltrusted=true) at pltcl.c:1418:13
frame #3: 0x0000000110355d50
pltcl.so`pltcl_func_handler(fcinfo=0x00007fb6f1817028,
call_state=0x00007ff7b0e61b80, pltrusted=true) at pltcl.c:814:12
...

Note that the hash_search call goes into some system library, not postgres.

The command to link pltcl is:

gcc ... -ltcl8.6 -lz -lpthread -framework CoreFoundation -lc
-bundle_loader ../../../src/backend/postgres

Notice the -lc in there. If I remove that, it works again.

The -lc is explicitly added in src/pl/tcl/Makefile, so it's our own
doing. I tracked this back, and it's been moved and rearranged in that
makefile a number of time. The original addition was

commit e3909672f12e0ddf3e202b824fda068ad2195ef2
Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Date: Mon Dec 14 00:46:49 1998

Build pltcl.so correctly on platforms that want dependent
shared libraries to be listed in the link command.

Has anyone else seen this?

Note, I'm using the tcl-tk package from Homebrew. The tcl installation
provided by macOS itself no longer appears to work for linking against.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2022-06-13 07:03:27 Re: Finer grain log timestamps
Previous Message Amit Kapila 2022-06-13 05:52:54 Re: Replica Identity check of partition table on subscriber