Re: [ROOT] Bug in loading and unloading libraries?

From: Paolo Adragna (paolo.adragna@pi.infn.it)
Date: Fri Nov 05 2004 - 09:16:45 MET


Rene,

the tar file and the instruction are in the first mail of this thread. I 
repeat everything here just to help you.

In these days me and my collegues are revising some code, dealing with dynamic 
loading and unloading of libraries. Due to problems and crashes, we set up a 
minimum program as a testbed from our development. The program is inside the 
attached tar file or can be found in 

/afs/cern.ch/user/a/adragna/public/dlopen-cint.tar.bz2

In the directory "scripts" there are some scripts with obvious names.

Compiling everything with the "compile.sh" script you can see the following 
executables:

1) dynalib-norootlib.exe
2) dynalib-rootlib.exe

and the following libraries:

a) myclass-nodict-norootlib.so
b) myclass-nodict-rootlib.so
c) myclass-dict-norootlib.so
d) myclass-dict-rootlib.so


The difference between the two executables is the following:
dynalib-rootlib.exe is linked against ROOT libs, in case some dlls would like 
to use them. dynalib-norootlib.exe is not linked (compare compile.sh)

More or less it is the same for the libraries:
a) myclass-nodict-norootlib.so is not linked and, also,  it has not the 
dictionary
b) myclass-nodict-rootlib.so is linked but it has not the dictionary
c) myclass-dict-norootlib.so is not linked but it has the dictionary
d) myclass-dict-rootlib.so has both the linking and the dictionary

Let's do the following trials.

1- dynalib-norootlib.exe myclass-nodict-norootlib.so

That's right: my library doesn't need to link ROOT libraries, everything works 
fine.

2- dynalib-norootlib.exe myclass-dict-norootlib.so 

This won't never work: ROOT libraries are never loaded but I nedd them because 
of the disctionary. As matter of facts, this trial doesn't succed, as 
expected. Good!

3- dynalib-norootlib.exe myclass-dict-rootlib.so 

Everything works fine also this time. The library myclass-dict-rootlib.so load 
herself the needed ROOT libraries. So far, so good.

4- dynalib-rootlib.exe myclass-dict-norootlib.so

It should work, with the libraries provided by the executable. But it 
crashes!! How can it happen? It seems a ROOT bug, but maybe there is 
something I didn't understand.

5- dynalib-norootlib.exe myclass-nodict-rootlib.so

It should work because the ROOT libraries are loaded by dlopen but never used 
(what's more, there is no dictionary), but also in this case we get a crash!

Of course there are other combinations, but I think our problem is clear.

My trial was performed on a RedHat 7.3, gcc 3.2, root 3.10.02 compiled with 
gcc 3.2.


After me, also my collegues and Philippe Canal performed some test. This is 
the sum of all the test.

1 - RedHat 7.3, gcc 3.2, root 3.10.02 (me on my machine)

this the table of results: false=crash.
 
                      root(1) noroot(2)

 dict-root(a)       false   true
 dict-noroot(b)    false   N/A
 nodict-root(c)    true    false
 nodict-noroot(d) true    true

2 - RedHat 7.3, gcc 3.2, root 3.10.02 (me on lxplus)

Everything works!

3 - Redhat 7.3 with gcc 3.2.1 (Philippe at Fermilab)

Everything works!

4 - redhat 7.3, gcc 3.3.1 (Philippe at Fermilab)

Everything works!

5 - Fedora 2, gcc 3.3.3, root 3.10.2 recompiled (my collegue)

Everything works!

7 - RedHat 7.3 CERN, gcc 2.95.2, root for gcc 2.95.2 (compiled by ROOT Team) 
(my collegue)

Various crashes (same table as in 1)

8 - Slackware 8,  gcc 2.95.3,  root recompiled (my collegue)

Various crashes (same table as in 1)

9 - Slackware 9.1, gcc 3.2.3, root recompiled

Everything works!


Also we noted, with the help of "strace" (at least during the test number 1) 
that various libraries (for example libcint) are not unloaded when unloading 
our custom library, and then we get a crash. Instead, when everything works, 
all the used libraries are correctly unload.

That's all, by now. Do not hesitate to ask for more information, if necessary.

Thank you, Rene.

Have a nice day,

Paolo Adragna



On Thursday 04 November 2004 21:58, Rene Brun wrote:
> Paolo,
>
> I do not see the definition of your cases in your original mail.
> Could you send me your most recent tar file (as short as possible)
> with a clear explanation of your cases and problems?
>
> Rene Brun
>
> On Wed,
> 3
>



-- 
Paolo Adragna
Istituto Nazionale di Fisica Nucleare
Sezione di Pisa
Via Buonarroti, 2 - Edificio C - Stanza 203
56127 Pisa - Italia
Tel. +39 050 221 4912




This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:10 MET