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

From: Wainer Vandelli (wainer.vandelli@pv.infn.it)
Date: Fri Nov 05 2004 - 15:12:22 MET


Hi all,
    I'm a collegue of Paolo. I have some news and corrections respect 
the previous Paolo's mail. I report here the correct result for all tests.

                      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

false=crash

1 - RedHat 7.3 CERN (official gcc 2.96) , gcc 3.2, root 3.10.02 (Paolo 
on lxplus)

Crashes (as in table)

2 - RedHat 7.3 CERN (official gcc 2.96), gcc 3.2, root 3.10.02 
recompiled (me on my computer)

Crashes (as in table)

3 - RedHat 7.3 CERN (official gcc 2.96), gcc 2.95.2, root for gcc 2.95.2 
(our collegue)

Crashes (as in table)

4 - RedHat 7.3 CERN (official gcc 2.96), gcc 3.3.1, root 3.10.02 
recompiled (me on my computer)

Crashes (as in table)

5 - Redhat 7.3 Fermilab?, gcc 3.2.1 (Philippe at Fermilab)

Everything works!

6 - Redhat 7.3 Fermilab?, gcc 3.3.1 (Philippe at Fermilab)

Everything works!

7 - Fedora 2 (official gcc 3.3.3), gcc 3.2.1, root 3.10.2 recompiled (me 
on my computer)

Everything works!

8 - Fedora 2 (official gcc 3.3.3), gcc 3.3.3, root 3.10.2 recompiled (me 
on my computer)

Everything works!

9 - Slackware 8 (official gcc 2.95.3),  gcc 2.95.3, root recompiled (our 
collegue)

Crashes (as in table)

10 - Slackware 9.1 (officiale gcc 3.2.3), gcc 3.2.3, root recompiled 
(our collegue)

Everything works!

Thank you. Cheers
			Wainer Vandelli





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



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