Hi!

As reported in #7041, MacOS build (even in Intel) is returning errors
after some time (1 min) used:

Authentication error
connection shutdown

I had debugged the problem, it happens when plugin manager tries to
unload plugins.

When it calls dlclose no error is returned but library is not really
unloaded.

Next time it loads the plugin again, it is already in memory and the
memory is not reinitialized nor constructors run again. Only the plugin
entry point is called.

That makes things unusable.

I have tracked why it is not unloading.

There is two reasons for it:
1) Usage of framework APIs / Objective-C
2) Usage of __thread variables

1) https://developer.apple.com/forums/thread/122591
2) https://github.com/rust-lang/rust/issues/28794#issuecomment-368693049

In our code (1) is happening with mac_utils.m and (2) due to
HAVE___THREAD being defined.

I have tested fixing (2) changing fb_tls.h define:

-#if defined(HAVE___THREAD)
+#if defined(HAVE___THREAD) && !defined(DARWIN)

And reverting mac_utils changes it worked.

There is also suspicious code in
src/yvalve/config/os/darwin/config_root.cpp but it has not needed to be
changed.

I have not deeply tested why this works in v3. It seems to not try to
unload plugins.


Adriano


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to