You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given a multi-threaded test that loads a dynamic module, calls a function, and then unloads the module in a loop, the expected behavior is for the module to be loaded/unloaded and it's init/fini called respectively everytime. Like so:
test start
init
dynamic function
fini
init
dynamic function
fini
test end
The expected behavior is observed when running on MacOS but not on Linux.
On Linux we observe the module's init/deinit function being called at the beginning and end of the test but also sporadically (but always in order) throughout the test. This hints that modules are not being unloaded each time (and instead shared amongst threads).
test start
init
dynamic function
.....
fini
init
dynamic function
fini
init
dynamic function
...
fini
test end
In addition to the behavior difference, on Linux this behavior also mostly results in a segmentation fault at some point in the program's execution.
No workaround to the behavior differences is known, but there is a workaround to the segmentation fault. Using RTLD_NODELETE when loading the module forces the loader to not unload the module until the process is killed (init called at beginning of test and fini at the very end).
Observed while using crate libloading
Given a multi-threaded test that loads a dynamic module, calls a function, and then unloads the module in a loop, the expected behavior is for the module to be loaded/unloaded and it's init/fini called respectively everytime. Like so:
The expected behavior is observed when running on MacOS but not on Linux.
On Linux we observe the module's init/deinit function being called at the beginning and end of the test but also sporadically (but always in order) throughout the test. This hints that modules are not being unloaded each time (and instead shared amongst threads).
In addition to the behavior difference, on Linux this behavior also mostly results in a segmentation fault at some point in the program's execution.
No workaround to the behavior differences is known, but there is a workaround to the segmentation fault. Using RTLD_NODELETE when loading the module forces the loader to not unload the module until the process is killed (init called at beginning of test and fini at the very end).
solana/src/dynamic_program.rs
Line 78 in dffb77b
The following repository will recreate the issue: https://github.com/jackcmay/dynamic_module_segfault
This issue is not to be confused with another loading issue on Linux having to do with TLS:
The text was updated successfully, but these errors were encountered: