JeffersonLab / JANA2

Multi-threaded HENP Event Reconstruction
https://jeffersonlab.github.io/JANA2/
Other
6 stars 9 forks source link

JPluginLoader: Second dlerror() call does not return error #291

Closed wdconinc closed 2 months ago

wdconinc commented 2 months ago

When a dlopen() fails on plugin loading, the JPluginLoader calls dlerror() multiple times (even though it's fewer times than 2.1.2). Remaining calls are at: https://github.com/JeffersonLab/JANA2/blob/59c2a54b77ba9c9e3bfae3c33b442206749f7310/src/libraries/JANA/Services/JPluginLoader.cc#L222-L223

"The function dlerror() returns a human readable string describing the most recent error that occurred from dlopen(), dlsym() or dlclose() since the last call to dlerror()." dlerror(3)

So, only the first dlerror() will contain the actual error, and we end up with empty error messages in exceptions, e.g. in 2.1.2 where another dlerror swallows the error message even for the regular log stream:

[INFO] JPluginLoader: Initializing plugin "/home/wdconinc/git/EICrecon/.worktree/omnifactory-RichTrack/lib/EICrecon/plugins/DRICH.so"
[WARN] JPluginLoader: Loading failure: 
[DEBUG] JPluginLoader: Looking for '/opt/software/linux-debian12-x86_64_v2/gcc-12.2.0/jana2-git.d8fe7adb523432d9e9b7e8fd98b97f7c646053a7_2.1.2-git.49-3ifdfnfpspf4epwpbzoc623eefrzedgs/plugins/JANA/DRICH.so' ....
wdconinc commented 2 months ago

As someone once wrote: "Again? This calls for unit tests."