Hi openmama team,
I see that on linux platform openmama uses dlopen() with RTLD_GLOBAL flag to load bridge implementations.
What do you think about changing that dlopen() call to use RTLD_LOCAL instead?
Using dlopen() with RTLD_LOCAL naturally provides named symbol isolation behavior one would expect from a system which dynamically loads implementations.
I cannot post a patch here yet but otherwise it is a trivial change to src/common/c_cpp/src/c/linux/platform.c line 65
Using RTLD_GLOBAL creates a problem if any two bridge implementations provide the same global symbol name. If loaded simultaneously these will share the same underlying object resolved through
the library loaded first.
For instance a crash can be reproduced with just loading tick42blp and tick42rmds bridges, and then closing mama. While mama is closing first bridge shutting down will destroy gTimerHeap object,
and then last bridge shutting down will attempt to destroy the same gTimerHeap once again.
A workaround would be to carefully examine non-local symbols from each bridge implementation and fix accordingly if bridge sources are available.
We can amend either blp or rmds bridge implementation - but this is not always possible and is obviously very inconvenient.
Note that on windows platform implementation already is behaving as non-global due to the fact that you always need explicitly loaded library handle to resolve a symbol.
OOO "Deutsche Bank TechCentre"
Business Center Aquamarine, Ozerkovskaya naberezhnaya 24, 115184 Moscow, Russia
Tel. +7 495 783-0313