macOS ARM Assertion (!defaultMemPool)

110 views
Skip to first unread message

Sergey Khalyutin

unread,
Feb 26, 2026, 10:05:48 AMFeb 26
to firebird-devel
same test in Windows and Linux amd64 is successfully;

under macOS ARM - set of Assertions (!defaultMemPool).

How it may by localised?


bin % ./isql -user sysdba employee
Assertion (!defaultMemPool) failure: /Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/alloc.cpp 1725
Database: employee, User: SYSDBA
SQL> select cast('RDB$RELATION_ID=' || RDB$RELATION_ID as varchar(20)) from rdb$database;

CAST                
====================
RDB$RELATION_ID=139  

SQL> exit;
zsh: segmentation fault  ./isql -user sysdba employee
bin %

///////////////////////////////////////////////////
bin %  ./firebird
Assertion (!defaultMemPool) failure: /Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/alloc.cpp 1725
Server started successfully
///////////////////////////////////////////////////

 %  ./isql -user sysdba -password 'masterkey'  localhost:employee          

Database: localhost:employee, User: SYSDBA
SQL> select 'RDB$RELATION_ID=' || cast(RDB$RELATION_ID as varchar(20)) from rdb$database;

CONCATENATION                        
====================================
RDB$RELATION_ID=139                  

SQL> exit;
bin %



debug command:

"program": "${workspaceFolder}/build/code/firebird/bin/isql",
"args": [  "-user", "sysdba", "employee", "-q", "-i", "${workspaceFolder}/test/create_user.sql"],

stack under debuger:
///////////////////////////

Assertion 1 (!defaultMemPool):

libfbclient.dylib!Firebird::MemPool::initDefaultPool() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/alloc.cpp:1725)
libfbclient.dylib!Firebird::MemoryPool::initDefaultPool() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/alloc.cpp:1920)
libfbclient.dylib!(anonymous namespace)::init() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.cpp:170)
libfbclient.dylib!Firebird::InstanceControl::InstanceControl() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.cpp:196)
libfbclient.dylib!Firebird::DeleteInstance<Firebird::InitInstance<Why::Dtc, Firebird::StaticInstanceAllocator<Why::Dtc>, Firebird::DeleteInstance>>::DeleteInstance() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.h:252)
libfbclient.dylib!Firebird::InitInstance<Why::Dtc, Firebird::StaticInstanceAllocator<Why::Dtc>, Firebird::DeleteInstance>::InitInstance() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.h:296)
libfbclient.dylib!Firebird::Static<Why::Dtc>::Static() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.h:346)
libfbclient.dylib!Firebird::Static<Why::Dtc>::Static() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.h:347)
libfbclient.dylib!::__cxx_global_var_init() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/yvalve/MasterImplementation.cpp:84)
libfbclient.dylib!_GLOBAL__sub_I_MasterImplementation.cpp (Unknown Source:0)


Assertion 2 (!defaultMemPool):

isql!Firebird::MemPool::initDefaultPool() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/alloc.cpp:1725)
isql!Firebird::MemoryPool::initDefaultPool() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/alloc.cpp:1920)
isql!(anonymous namespace)::init() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.cpp:170)
isql!Firebird::InstanceControl::InstanceControl() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.cpp:196)
isql!Firebird::DeleteInstance<Firebird::InitInstance<Firebird::SimpleFactoryBase<Auth::SrpClientImpl<Firebird::Sha1>>, Firebird::StaticInstanceAllocator<Firebird::SimpleFactoryBase<Auth::SrpClientImpl<Firebird::Sha1>>>, Firebird::DeleteInstance>>::DeleteInstance() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.h:252)
isql!Firebird::InitInstance<Firebird::SimpleFactoryBase<Auth::SrpClientImpl<Firebird::Sha1>>, Firebird::StaticInstanceAllocator<Firebird::SimpleFactoryBase<Auth::SrpClientImpl<Firebird::Sha1>>>, Firebird::DeleteInstance>::InitInstance() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.h:296)
isql!Firebird::Static<Firebird::SimpleFactoryBase<Auth::SrpClientImpl<Firebird::Sha1>>>::Static() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.h:346)
isql!Firebird::SimpleFactory<Auth::SrpClientImpl<Firebird::Sha1>>::SimpleFactory() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/ImplementHelper.h:187)
isql!Firebird::SimpleFactory<Auth::SrpClientImpl<Firebird::Sha1>>::SimpleFactory() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/ImplementHelper.h:187)
isql!::__cxx_global_var_init() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/auth/SecureRemotePassword/client/SrpClient.cpp:182)
isql!_GLOBAL__sub_I_SrpClient.cpp (Unknown Source:0)
...

Assertion 3 (!defaultMemPool):

libEngine14.dylib!Firebird::MemPool::initDefaultPool() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/alloc.cpp:1725)
libEngine14.dylib!Firebird::MemoryPool::initDefaultPool() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/alloc.cpp:1920)
libEngine14.dylib!(anonymous namespace)::init() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.cpp:170)
libEngine14.dylib!Firebird::InstanceControl::InstanceControl() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.cpp:196)
libEngine14.dylib!Firebird::DeleteInstance<Firebird::InitInstance<(anonymous namespace)::IbUtilStartup, Firebird::DefaultInstanceAllocator<(anonymous namespace)::IbUtilStartup>, Firebird::DeleteInstance>>::DeleteInstance() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.h:252)
libEngine14.dylib!Firebird::InitInstance<(anonymous namespace)::IbUtilStartup, Firebird::DefaultInstanceAllocator<(anonymous namespace)::IbUtilStartup>, Firebird::DeleteInstance>::InitInstance() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.h:296)
libEngine14.dylib!Firebird::InitInstance<(anonymous namespace)::IbUtilStartup, Firebird::DefaultInstanceAllocator<(anonymous namespace)::IbUtilStartup>, Firebird::DeleteInstance>::InitInstance() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.h:298)
libEngine14.dylib!::__cxx_global_var_init.2() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/build/code/src/jrd/fun.epp.master.cpp:109)
libEngine14.dylib!_GLOBAL__sub_I_fun.epp.master.cpp (Unknown Source:0)
...

Assertion 4,5 (!defaultMemPool):

isql!Firebird::MemPool::initDefaultPool() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/alloc.cpp:1725)
libfbintl.dylib!Firebird::MemoryPool::initDefaultPool() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/alloc.cpp:1920)
libfbintl.dylib!(anonymous namespace)::init() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.cpp:170)
libfbintl.dylib!Firebird::InstanceControl::InstanceControl() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.cpp:196)
libfbintl.dylib!Firebird::DeleteInstance<Firebird::InitInstance<Why::Dtc, Firebird::StaticInstanceAllocator<Why::Dtc>, Firebird::DeleteInstance>>::DeleteInstance() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.h:252)
libfbintl.dylib!Firebird::InitInstance<Why::Dtc, Firebird::StaticInstanceAllocator<Why::Dtc>, Firebird::DeleteInstance>::InitInstance() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.h:296)
libfbintl.dylib!Firebird::Static<Why::Dtc>::Static() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.h:346)
libfbintl.dylib!Firebird::Static<Why::Dtc>::Static() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/init.h:347)
libfbintl.dylib!::__cxx_global_var_init() (/Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/yvalve/MasterImplementation.cpp:84)
libfbintl.dylib!_GLOBAL__sub_I_MasterImplementation.cpp (Unknown Source:0)
...

Adriano dos Santos Fernandes

unread,
Feb 26, 2026, 7:49:13 PMFeb 26
to firebir...@googlegroups.com
On 2/26/26 12:05, Sergey Khalyutin wrote:
> same test in Windows and Linux amd64 is successfully;
>
> under macOS ARM - set of Assertions (!defaultMemPool).
>
> How it may by localised?
>

Due to undefined behavior.

Try this patch:

diff --git a/src/common/classes/init.cpp b/src/common/classes/init.cpp
index 75949ae6a9..7a63cd1b31 100644
--- a/src/common/classes/init.cpp
+++ b/src/common/classes/init.cpp
@@ -70,7 +70,7 @@ namespace
#endif

// This helps initialize globals, needed before regular ctors run
- int initDone = 0;
+ std::atomic_int initDone = 0;

#ifdef HAVE_PTHREAD_ATFORK
void child(void)


Adriano

Sergey Khalyutin

unread,
Feb 27, 2026, 10:46:23 AMFeb 27
to firebird-devel
Thanks for  patch, Adriano.
replace
--   int initDone = 0;
++ std::atomic_int initDone = 0;
not help, unfortunate...

Assertions "(!default MemPool)" stable raised on load libintl.dylib first call of init() 
after dlopen() called from EngineStartup::init().
sleep(3); before IntlManager::initialize(); not help,...

Loaded /SQLfb/build/code/firebird/plugins/libEngine14.dylib'. Symbols loaded.
Loaded /SQLfb/build/code/firebird/lib/libib_util.dylib'. Symbols loaded.
Loaded '/SQLfb/build/code/firebird/intl/libfbintl.dylib'. Symbols loaded.
Assertion (!defaultMemPool) failure: /SQLfb/code/src/common/classes/alloc.cpp 1725.  <---
Loaded '/SQLfb/build/code/ICU/distr/lib/libicuuc.77.1.dylib'. Symbols loaded.
Loaded '/SQLfb/build/code/ICU/distr/lib/libicudata.77.1.dylib'. Symbols loaded.
Loaded '/SQLfb/build/code/ICU/distr/lib/libicui18n.77.1.dylib'. Symbols loaded.
Loaded '/SQLfb/build/code/firebird/plugins/libSrp.dylib'. Symbols loaded.
The program '/SQLfb/build/code/firebird/bin/isql' has exited with code 42 (0x0000002a).

void init()
{
if (initDone != 0)
{
return;
}

Firebird::Mutex::initMutexes();
Firebird::MemoryPool::initDefaultPool(); <--
Firebird::StaticMutex::create();

#ifdef DEBUG_INIT. // == NOT
atexit(allClean);
#endif //DEBUG_INIT

initDone = 1;
#ifdef HAVE_PTHREAD_ATFORK // == NOT
std::ignore = pthread_atfork(NULL, NULL, child);
#endif

Firebird::MemoryPool::contextPoolInit();
}


class EngineStartup
{
public:
static void init()
{
IbUtil::initialize();
IntlManager::initialize(); <--
ExtEngineManager::initialize();
}

static void cleanup() noexcept
{
}
};

Hamish Moffatt

unread,
Mar 15, 2026, 9:12:07 PMMar 15
to firebir...@googlegroups.com
On 27/2/26 02:05, Sergey Khalyutin wrote:
same test in Windows and Linux amd64 is successfully;

under macOS ARM - set of Assertions (!defaultMemPool).

How it may by localised?


bin % ./isql -user sysdba employee
Assertion (!defaultMemPool) failure: /Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/alloc.cpp 1725
Database: employee, User: SYSDBA
SQL> select cast('RDB$RELATION_ID=' || RDB$RELATION_ID as varchar(20)) from rdb$database;


Is this applying with a particular version or environment? I don't see it with the 5.0.3 release:


$ isql -z localhost:employee
ISQL Version: UI-V5.0.3.1683 Firebird 5.0
Server version:
UI-V5.0.3.1683 Firebird 5.0
UI-V5.0.3.1683 Firebird 5.0/tcp (hamish-mac-m1-2.xyz)/P19:C
UI-V5.0.3.1683 Firebird 5.0/tcp (hamish-mac-m1-2.xyz)/P19:C


Database: localhost:employee, User: SYSDBA

SQL> select cast('RDB$RELATION_ID=' || RDB$RELATION_ID as varchar(20)) from rdb$database;

CAST                 
==================== 
RDB$RELATION_ID=139  



Hamish

Alex Peshkoff

unread,
Mar 16, 2026, 6:41:28 AMMar 16
to firebir...@googlegroups.com
On 3/16/26 04:11, 'Hamish Moffatt' via firebird-devel wrote:
On 27/2/26 02:05, Sergey Khalyutin wrote:
same test in Windows and Linux amd64 is successfully;

under macOS ARM - set of Assertions (!defaultMemPool).

How it may by localised?


bin % ./isql -user sysdba employee
Assertion (!defaultMemPool) failure: /Users/khalyutin/WORK/source/COMPONENTS/SQLfb/code/src/common/classes/alloc.cpp 1725

What makes be specially surprised - why does isql proceed working after assert? 


Database: employee, User: SYSDBA
SQL> select cast('RDB$RELATION_ID=' || RDB$RELATION_ID as varchar(20)) from rdb$database;



Set conditional breakpoint at that line and get stack trace first of all.

(may be that's once again due to external synbols visibility?)


Sergey Khalyutin

unread,
Mar 16, 2026, 8:40:41 AMMar 16
to firebird-devel

to: 

Hamish Moffatt

> Is this applying with a particular version or environment? I don't see it with the 5.0.3 release:

subject about build  FB v6 on macOS with CMake build system

to:
Alex Peshkoff


> What makes be specially surprised - why does isql proceed working after assert? 

In debugging purposes I replaced fb_assert  to fb_assert_continue :)...

> (may be that's once again due to external synbols visibility?)

Yes,   You are right,  add_compile_options("-fvisibility=hidden")  (on macOS CMake) solved problem. Thanks!

Dimitry Sibiryakov

unread,
Mar 16, 2026, 8:44:35 AMMar 16
to firebir...@googlegroups.com
Sergey Khalyutin wrote 16.03.2026 13:40:
> Yes, You are right,  add_compile_options("-fvisibility=hidden")  (on macOS
> CMake) solved problem.

It must be the default for all platforms.

--
WBR, SD.

Sergey Khalyutin

unread,
Mar 16, 2026, 9:04:19 AMMar 16
to firebird-devel

> It must be the default for all platforms.

Unfortunately, this wasn't by default in macOS...

Dimitry Sibiryakov

unread,
Mar 16, 2026, 9:06:46 AMMar 16
to firebir...@googlegroups.com
Sergey Khalyutin wrote 16.03.2026 14:04:
> Unfortunately, this wasn't by default in macOS...

Don't CMake build has "common properties" that are applied to every platform
automatically? Or this setting was intentionally overridden for MacOS?

--
WBR, SD.

Sergey Khalyutin

unread,
Mar 16, 2026, 9:47:49 AMMar 16
to firebird-devel

Dimitry Sibiryakov
>Don't CMake build has "common properties" that are applied to every platform
>automatically? Or this setting was intentionally overridden for MacOS?


We used the existing FB project's Makefile as a basis—they didn't have -fvisibility=hidden at all.
The issue didn't occur on Windows or Linux.

-fvisibility=hidden
appears only in
builds\posix\prefix.darwin_aarch64
and
builds\posix\prefix.darwin_x86_64

I'm not entirely sure why the issue didn't occur on Windows or Linux. Was it a coincidence or was global variables hidden by default?

Dimitry Sibiryakov

unread,
Mar 16, 2026, 9:51:42 AMMar 16
to firebir...@googlegroups.com
Sergey Khalyutin wrote 16.03.2026 14:47:
> We used the existing FB project's Makefile as a basis—they didn't have -
> fvisibility=hidden at all.

That's a big mistake.

> I'm not entirely sure why the issue didn't occur on Windows or Linux. Was it a coincidence or was global variables hidden by default?

On Windows - yes, every symbol is private unless explicitly exported. On
Linux they are public by default, so I guess it is a pure luck that no crashes
happen so far.

--
WBR, SD.

Hamish Moffatt

unread,
Mar 16, 2026, 6:24:48 PMMar 16
to firebir...@googlegroups.com
On 17/3/26 00:47, Sergey Khalyutin wrote:
>
> We used the existing FB project's Makefile as a basis—they didn't have
> -fvisibility=hidden at all.
> The issue didn't occur on Windows or Linux.
>
> -fvisibility=hidden
> appears only in
> builds\posix\prefix.darwin_aarch64
> and
> builds\posix\prefix.darwin_x86_64


I don't quite understand - don't those files make up the Makefile, but
you said it was missing that compiler flag?


Hamish

Adriano dos Santos Fernandes

unread,
Mar 16, 2026, 7:13:20 PMMar 16
to firebir...@googlegroups.com
On 3/16/26 10:47, Sergey Khalyutin wrote:
>
> Dimitry Sibiryakov's profile photo
> Dimitry Sibiryakov
>>Don't CMake build has "common properties" that are applied to every
> platform
>>automatically? Or this setting was intentionally overridden for MacOS?
>
>
> We used the existing FB project's Makefile as a basis—they didn't have -
> fvisibility=hidden at all.
> The issue didn't occur on Windows or Linux.
>
> -fvisibility=hidden
> appears only in
> builds\posix\prefix.darwin_aarch64
> and
> builds\posix\prefix.darwin_x86_64
>
> I'm not entirely sure why the issue didn't occur on Windows or Linux.
> Was it a coincidence or was global variables hidden by default?
>

Firebird use version script files and specify what symbols are exported.

See -exported_symbols_list, --version-script, LIB_LINK_MAPFILE.


Adriano

Sergey Khalyutin

unread,
Mar 17, 2026, 3:29:53 AMMar 17
to firebird-devel
Sorry. typo.
-- We used the existing FB project's Makefile as a basis—they didn't have
++ We used the existing FB project's CMake files as a basis—they didn't have


Alex Peshkoff

unread,
Mar 17, 2026, 4:50:41 AMMar 17
to firebir...@googlegroups.com
Yes - but for Mac it's not enough :-(


Reply all
Reply to author
Forward
0 new messages