public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/311] New: dlclose doesn't close all dependent libraries
@ 2004-08-07 21:21 carlo at alinoe dot com
2004-08-09 8:26 ` [Bug libc/311] " jakub at redhat dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: carlo at alinoe dot com @ 2004-08-07 21:21 UTC (permalink / raw)
To: glibc-bugs
I noted that when I dlopen a shared library which depends on
other libraries - then these other libraries are automatically
loaded as well; but, when then I dlclose this library - the
automatically loaded libraries are not all closed (only some).
This seems not what was intended, is that correct?
Example, using the application I am working on:
Before calling dlopen:
$ cat /proc/12219/maps | grep 'r-xp'
08048000-080a6000 r-xp 00000000 22:01 670016
/usr/src/edragon/edragon/build/src/edragon
40000000-40011000 r-xp 00000000 22:01 1504392
/usr/src/install/debug/lib/ld-2.3.3.so
40013000-40028000 r-xp 00000000 22:01 1527029
/usr/src/install/3.5.0-20040530/lib/libboost_filesystem-gcc-d-1_31.so.1.31.0
40029000-400c4000 r-xp 00000000 22:01 1527133
/usr/src/install/3.5.0-20040530/lib/libglib-2.0.so.0.400.4
400c5000-400c8000 r-xp 00000000 22:01 1527125
/usr/src/install/3.5.0-20040530/lib/libxsltwrapp.so.2
400ca000-400e5000 r-xp 00000000 22:01 1527123
/usr/src/install/3.5.0-20040530/lib/libxmlwrapp.so.5
400e6000-400f4000 r-xp 00000000 03:01 97771 /usr/lib/libexslt.so.0.8.4
400f5000-40124000 r-xp 00000000 03:01 97914 /usr/lib/libxslt.so.1.1.5
40125000-40206000 r-xp 00000000 03:01 98142 /usr/lib/libxml2.so.2.6.8
40218000-40228000 r-xp 00000000 03:01 98366 /usr/lib/libz.so.1.2.0.7
4022a000-40236000 r-xp 00000000 22:01 1504422
/usr/src/install/debug/lib/libpthread-0.10.so
4027b000-40302000 r-xp 00000000 22:01 1527127
/usr/src/install/3.5.0-20040530/lib/libcw.so.0.0.0
40309000-403b7000 r-xp 00000000 22:01 1527112
/usr/src/install/3.5.0-20040530/lib/libcwd.so.0.99.38
403bb000-403bd000 r-xp 00000000 22:01 1504410
/usr/src/install/debug/lib/libdl-2.3.3.so
403be000-40487000 r-xp 00000000 22:01 2950727
/usr/src/GNU/install/lib/libstdc++.so.6.0.0
40491000-404b1000 r-xp 00000000 22:01 1504405
/usr/src/install/debug/lib/libm-2.3.3.so
404b2000-404ba000 r-xp 00000000 22:01 2950722
/usr/src/GNU/install/lib/libgcc_s.so.1
404bc000-405a3000 r-xp 00000000 22:01 1504391
/usr/src/install/debug/lib/libc-2.3.3.so
40afc000-40b04000 r-xp 00000000 22:01 1504440
/usr/src/install/debug/lib/libnss_files-2.3.3.so
After calling dlopen("/usr/src/edragon/edragon/build/src/gui/.libs/gui.so.0"):
$ cat /proc/12219/maps | grep 'r-xp'
08048000-080a6000 r-xp 00000000 22:01 670016
/usr/src/edragon/edragon/build/src/edragon
40000000-40011000 r-xp 00000000 22:01 1504392
/usr/src/install/debug/lib/ld-2.3.3.so
40013000-40028000 r-xp 00000000 22:01 1527029
/usr/src/install/3.5.0-20040530/lib/libboost_filesystem-gcc-d-1_31.so.1.31.0
40029000-400c4000 r-xp 00000000 22:01 1527133
/usr/src/install/3.5.0-20040530/lib/libglib-2.0.so.0.400.4
400c5000-400c8000 r-xp 00000000 22:01 1527125
/usr/src/install/3.5.0-20040530/lib/libxsltwrapp.so.2
400ca000-400e5000 r-xp 00000000 22:01 1527123
/usr/src/install/3.5.0-20040530/lib/libxmlwrapp.so.5
400e6000-400f4000 r-xp 00000000 03:01 97771 /usr/lib/libexslt.so.0.8.4
400f5000-40124000 r-xp 00000000 03:01 97914 /usr/lib/libxslt.so.1.1.5
40125000-40206000 r-xp 00000000 03:01 98142 /usr/lib/libxml2.so.2.6.8
40218000-40228000 r-xp 00000000 03:01 98366 /usr/lib/libz.so.1.2.0.7
4022a000-40236000 r-xp 00000000 22:01 1504422
/usr/src/install/debug/lib/libpthread-0.10.so
4027b000-40302000 r-xp 00000000 22:01 1527127
/usr/src/install/3.5.0-20040530/lib/libcw.so.0.0.0
40309000-403b7000 r-xp 00000000 22:01 1527112
/usr/src/install/3.5.0-20040530/lib/libcwd.so.0.99.38
403bb000-403bd000 r-xp 00000000 22:01 1504410
/usr/src/install/debug/lib/libdl-2.3.3.so
403be000-40487000 r-xp 00000000 22:01 2950727
/usr/src/GNU/install/lib/libstdc++.so.6.0.0
40491000-404b1000 r-xp 00000000 22:01 1504405
/usr/src/install/debug/lib/libm-2.3.3.so
404b2000-404ba000 r-xp 00000000 22:01 2950722
/usr/src/GNU/install/lib/libgcc_s.so.1
404bc000-405a3000 r-xp 00000000 22:01 1504391
/usr/src/install/debug/lib/libc-2.3.3.so
40afc000-40b04000 r-xp 00000000 22:01 1504440
/usr/src/install/debug/lib/libnss_files-2.3.3.so
40bbd000-40be4000 r-xp 00000000 22:01 774821
/usr/src/edragon/edragon/build/src/gui/.libs/gui.so.0.0.0
40ef5000-412c8000 r-xp 00000000 22:01 1527003
/usr/src/install/3.5.0-20040530/lib/libgtk-x11-2.0.so.0.400.4
412d4000-41370000 r-xp 00000000 22:01 1527139
/usr/src/install/3.5.0-20040530/lib/libgdk-x11-2.0.so.0.400.4
41375000-41392000 r-xp 00000000 22:01 1526937
/usr/src/install/3.5.0-20040530/lib/libatk-1.0.so.0.600.1
41394000-413af000 r-xp 00000000 22:01 1527138
/usr/src/install/3.5.0-20040530/lib/libgdk_pixbuf-2.0.so.0.400.4
413b0000-413b5000 r-xp 00000000 22:01 1526913
/usr/src/install/3.5.0-20040530/lib/libpangoxft-1.0.so.0.399.1
413b6000-413c3000 r-xp 00000000 22:01 1526909
/usr/src/install/3.5.0-20040530/lib/libpangox-1.0.so.0.399.1
413c4000-41401000 r-xp 00000000 22:01 1526905
/usr/src/install/3.5.0-20040530/lib/libpango-1.0.so.0.399.1
41406000-4144d000 r-xp 00000000 22:01 1527134
/usr/src/install/3.5.0-20040530/lib/libgobject-2.0.so.0.400.4
4144f000-41452000 r-xp 00000000 22:01 1527135
/usr/src/install/3.5.0-20040530/lib/libgmodule-2.0.so.0.400.4
41453000-4152e000 r-xp 00000000 03:01 146538 /usr/X11R6/lib/libX11.so.6.2
41531000-41534000 r-xp 00000000 03:01 147402 /usr/X11R6/lib/libXrandr.so.2.0
41535000-41542000 r-xp 00000000 03:01 146577 /usr/X11R6/lib/libXext.so.6.4
41543000-41554000 r-xp 00000000 03:01 147263 /usr/X11R6/lib/libXft.so.2.1.1
41555000-415b3000 r-xp 00000000 03:01 98034 /usr/lib/libfreetype.so.6.3.5
415ba000-415c1000 r-xp 00000000 03:01 147404 /usr/X11R6/lib/libXrender.so.1.2.2
415c2000-415e5000 r-xp 00000000 03:01 98351 /usr/lib/libfontconfig.so.1.0.4
415e9000-415f1000 r-xp 00000000 03:01 146565 /usr/X11R6/lib/libXcursor.so.1.0
415f2000-41625000 r-xp 00000000 22:01 1526917
/usr/src/install/3.5.0-20040530/lib/libpangoft2-1.0.so.0.399.1
41626000-41644000 r-xp 00000000 03:01 98590 /usr/lib/libexpat.so.0.4.0
419fb000-419fd000 r-xp 00000000 03:01 505054
/usr/X11R6/lib/X11/locale/lib/common/xlcDef.so.2
419fe000-419ff000 r-xp 00000000 22:01 1514691
/usr/src/install/debug/lib/gconv/ISO8859-1.so
And then after calling dlclose() for that library:
$ cat /proc/12219/maps | grep 'r-xp'
08048000-080a6000 r-xp 00000000 22:01 670016
/usr/src/edragon/edragon/build/src/edragon
40000000-40011000 r-xp 00000000 22:01 1504392
/usr/src/install/debug/lib/ld-2.3.3.so
40013000-40028000 r-xp 00000000 22:01 1527029
/usr/src/install/3.5.0-20040530/lib/libboost_filesystem-gcc-d-1_31.so.1.31.0
40029000-400c4000 r-xp 00000000 22:01 1527133
/usr/src/install/3.5.0-20040530/lib/libglib-2.0.so.0.400.4
400c5000-400c8000 r-xp 00000000 22:01 1527125
/usr/src/install/3.5.0-20040530/lib/libxsltwrapp.so.2
400ca000-400e5000 r-xp 00000000 22:01 1527123
/usr/src/install/3.5.0-20040530/lib/libxmlwrapp.so.5
400e6000-400f4000 r-xp 00000000 03:01 97771 /usr/lib/libexslt.so.0.8.4
400f5000-40124000 r-xp 00000000 03:01 97914 /usr/lib/libxslt.so.1.1.5
40125000-40206000 r-xp 00000000 03:01 98142 /usr/lib/libxml2.so.2.6.8
40218000-40228000 r-xp 00000000 03:01 98366 /usr/lib/libz.so.1.2.0.7
4022a000-40236000 r-xp 00000000 22:01 1504422
/usr/src/install/debug/lib/libpthread-0.10.so
4027b000-40302000 r-xp 00000000 22:01 1527127
/usr/src/install/3.5.0-20040530/lib/libcw.so.0.0.0
40309000-403b7000 r-xp 00000000 22:01 1527112
/usr/src/install/3.5.0-20040530/lib/libcwd.so.0.99.38
403bb000-403bd000 r-xp 00000000 22:01 1504410
/usr/src/install/debug/lib/libdl-2.3.3.so
403be000-40487000 r-xp 00000000 22:01 2950727
/usr/src/GNU/install/lib/libstdc++.so.6.0.0
40491000-404b1000 r-xp 00000000 22:01 1504405
/usr/src/install/debug/lib/libm-2.3.3.so
404b2000-404ba000 r-xp 00000000 22:01 2950722
/usr/src/GNU/install/lib/libgcc_s.so.1
404bc000-405a3000 r-xp 00000000 22:01 1504391
/usr/src/install/debug/lib/libc-2.3.3.so
40afc000-40b04000 r-xp 00000000 22:01 1504440
/usr/src/install/debug/lib/libnss_files-2.3.3.so
41394000-413af000 r-xp 00000000 22:01 1527138
/usr/src/install/3.5.0-20040530/lib/libgdk_pixbuf-2.0.so.0.400.4
413b0000-413b5000 r-xp 00000000 22:01 1526913
/usr/src/install/3.5.0-20040530/lib/libpangoxft-1.0.so.0.399.1
413b6000-413c3000 r-xp 00000000 22:01 1526909
/usr/src/install/3.5.0-20040530/lib/libpangox-1.0.so.0.399.1
413c4000-41401000 r-xp 00000000 22:01 1526905
/usr/src/install/3.5.0-20040530/lib/libpango-1.0.so.0.399.1
41406000-4144d000 r-xp 00000000 22:01 1527134
/usr/src/install/3.5.0-20040530/lib/libgobject-2.0.so.0.400.4
4144f000-41452000 r-xp 00000000 22:01 1527135
/usr/src/install/3.5.0-20040530/lib/libgmodule-2.0.so.0.400.4
41453000-4152e000 r-xp 00000000 03:01 146538 /usr/X11R6/lib/libX11.so.6.2
41531000-41534000 r-xp 00000000 03:01 147402 /usr/X11R6/lib/libXrandr.so.2.0
41535000-41542000 r-xp 00000000 03:01 146577 /usr/X11R6/lib/libXext.so.6.4
41543000-41554000 r-xp 00000000 03:01 147263 /usr/X11R6/lib/libXft.so.2.1.1
41555000-415b3000 r-xp 00000000 03:01 98034 /usr/lib/libfreetype.so.6.3.5
415ba000-415c1000 r-xp 00000000 03:01 147404 /usr/X11R6/lib/libXrender.so.1.2.2
415c2000-415e5000 r-xp 00000000 03:01 98351 /usr/lib/libfontconfig.so.1.0.4
415e9000-415f1000 r-xp 00000000 03:01 146565 /usr/X11R6/lib/libXcursor.so.1.0
415f2000-41625000 r-xp 00000000 22:01 1526917
/usr/src/install/3.5.0-20040530/lib/libpangoft2-1.0.so.0.399.1
41626000-41644000 r-xp 00000000 03:01 98590 /usr/lib/libexpat.so.0.4.0
419fb000-419fd000 r-xp 00000000 03:01 505054
/usr/X11R6/lib/X11/locale/lib/common/xlcDef.so.2
419fe000-419ff000 r-xp 00000000 22:01 1514691
/usr/src/install/debug/lib/gconv/ISO8859-1.so
Nothing else was done in between... Note that the dlclose() did close SOME
libraries,
the difference is in fact:
- 40bbd000-40be4000 r-xp 00000000 22:01 774821
/usr/src/edragon/edragon/build/src/gui/.libs/gui.so.0.0.0
- 40ef5000-412c8000 r-xp 00000000 22:01 1527003
/usr/src/install/3.5.0-20040530/lib/libgtk-x11-2.0.so.0.400.4
- 412d4000-41370000 r-xp 00000000 22:01 1527139
/usr/src/install/3.5.0-20040530/lib/libgdk-x11-2.0.so.0.400.4
- 41375000-41392000 r-xp 00000000 22:01 1526937
/usr/src/install/3.5.0-20040530/lib/libatk-1.0.so.0.600.1
But the following libraries were added but not removed anymore:
+ 41394000-413af000 r-xp 00000000 22:01 1527138
/usr/src/install/3.5.0-20040530/lib/libgdk_pixbuf-2.0.so.0.400.4
+ 413b0000-413b5000 r-xp 00000000 22:01 1526913
/usr/src/install/3.5.0-20040530/lib/libpangoxft-1.0.so.0.399.1
+ 413b6000-413c3000 r-xp 00000000 22:01 1526909
/usr/src/install/3.5.0-20040530/lib/libpangox-1.0.so.0.399.1
+ 413c4000-41401000 r-xp 00000000 22:01 1526905
/usr/src/install/3.5.0-20040530/lib/libpango-1.0.so.0.399.1
+ 41406000-4144d000 r-xp 00000000 22:01 1527134
/usr/src/install/3.5.0-20040530/lib/libgobject-2.0.so.0.400.4
+ 4144f000-41452000 r-xp 00000000 22:01 1527135
/usr/src/install/3.5.0-20040530/lib/libgmodule-2.0.so.0.400.4
+ 41453000-4152e000 r-xp 00000000 03:01 146538 /usr/X11R6/lib/libX11.so.6.2
+ 41531000-41534000 r-xp 00000000 03:01 147402 /usr/X11R6/lib/libXrandr.so.2.0
+ 41535000-41542000 r-xp 00000000 03:01 146577 /usr/X11R6/lib/libXext.so.6.4
+ 41543000-41554000 r-xp 00000000 03:01 147263 /usr/X11R6/lib/libXft.so.2.1.1
+ 41555000-415b3000 r-xp 00000000 03:01 98034 /usr/lib/libfreetype.so.6.3.5
+ 415ba000-415c1000 r-xp 00000000 03:01 147404
/usr/X11R6/lib/libXrender.so.1.2.2
+ 415c2000-415e5000 r-xp 00000000 03:01 98351 /usr/lib/libfontconfig.so.1.0.4
+ 415e9000-415f1000 r-xp 00000000 03:01 146565 /usr/X11R6/lib/libXcursor.so.1.0
+ 415f2000-41625000 r-xp 00000000 22:01 1526917
/usr/src/install/3.5.0-20040530/lib/libpangoft2-1.0.so.0.399.1
+ 41626000-41644000 r-xp 00000000 03:01 98590 /usr/lib/libexpat.so.0.4.0
+ 419fb000-419fd000 r-xp 00000000 03:01 505054
/usr/X11R6/lib/X11/locale/lib/common/xlcDef.so.2
+ 419fe000-419ff000 r-xp 00000000 22:01 1514691
/usr/src/install/debug/lib/gconv/ISO8859-1.so
Those are so to say "leaking" ...
Is there anything I should do to get those libs to close too?
Do you want me to test something (I have a libc with debugging info
around too).
--
Summary: dlclose doesn't close all dependent libraries
Product: glibc
Version: 2.3.3
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: gotom at debian dot or dot jp
ReportedBy: carlo at alinoe dot com
CC: glibc-bugs at sources dot redhat dot com
http://sources.redhat.com/bugzilla/show_bug.cgi?id=311
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libc/311] dlclose doesn't close all dependent libraries
2004-08-07 21:21 [Bug libc/311] New: dlclose doesn't close all dependent libraries carlo at alinoe dot com
@ 2004-08-09 8:26 ` jakub at redhat dot com
2004-08-17 14:16 ` carlo at alinoe dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: jakub at redhat dot com @ 2004-08-09 8:26 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From jakub at redhat dot com 2004-08-09 08:26 -------
Most likely this is because of relocation dependencies.
You can run the program with LD_DEBUG=all and for each library which has not
been closed during dlclose but hasn't been loaded before dlopen, you can look
in the output why it has not been released.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |WAITING
http://sources.redhat.com/bugzilla/show_bug.cgi?id=311
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libc/311] dlclose doesn't close all dependent libraries
2004-08-07 21:21 [Bug libc/311] New: dlclose doesn't close all dependent libraries carlo at alinoe dot com
2004-08-09 8:26 ` [Bug libc/311] " jakub at redhat dot com
@ 2004-08-17 14:16 ` carlo at alinoe dot com
2004-08-17 14:19 ` carlo at alinoe dot com
2005-07-08 16:26 ` drepper at redhat dot com
3 siblings, 0 replies; 5+ messages in thread
From: carlo at alinoe dot com @ 2004-08-17 14:16 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From carlo at alinoe dot com 2004-08-17 14:16 -------
Created an attachment (id=166)
--> (http://sources.redhat.com/bugzilla/attachment.cgi?id=166&action=view)
bzip2 compressed output of: LD_DEBUG=all ./edragon -da -um,b,g,s 2> debug.out
--
http://sources.redhat.com/bugzilla/show_bug.cgi?id=311
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libc/311] dlclose doesn't close all dependent libraries
2004-08-07 21:21 [Bug libc/311] New: dlclose doesn't close all dependent libraries carlo at alinoe dot com
2004-08-09 8:26 ` [Bug libc/311] " jakub at redhat dot com
2004-08-17 14:16 ` carlo at alinoe dot com
@ 2004-08-17 14:19 ` carlo at alinoe dot com
2005-07-08 16:26 ` drepper at redhat dot com
3 siblings, 0 replies; 5+ messages in thread
From: carlo at alinoe dot com @ 2004-08-17 14:19 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From carlo at alinoe dot com 2004-08-17 14:19 -------
Sorry it took so long.
Using LD_DEBUG=all crashed the application, here:
(gdb) bt
#0 0x400115d3 in strlen () from /lib/ld-linux.so.2
#1 0x4000c832 in _dl_debug_vdprintf () from /lib/ld-linux.so.2
#2 0x4000c4c9 in _dl_debug_printf () from /lib/ld-linux.so.2
#3 0x4000bac3 in _dl_signal_cerror () from /lib/ld-linux.so.2
#4 0x40008323 in _dl_lookup_symbol_x () from /lib/ld-linux.so.2
#5 0x4058bffc in do_dlsym () from /lib/tls/libc.so.6
#6 0x00000000 in ?? ()
Not very useful I guess.
I then started to use my libc with debugging symbols, but
that just worked: no crash.
Anyway - I do not understand how to interpret the output.
Some libraries that are loaded and not unloaded aren't even mentioned
in the output.
Can you have a look at the output? The same libraries
as in the initial report are valid - except that now I am using
g++ 3.5 (20040813), so the path of many libs has changed to
/usr/src/install/3.5.0-20040813/ etc.
The output was bzip2-ed and attached as debug.out.bz2.
dlclosing of the "gui" happens at the [...] between the lines
PLUGIN : Entering PluginsManager::unload_plugins... <unfinished>
PLUGIN : Calling PluginFile::dlclose for plugin "gui".
[...]
PLUGIN : <continued> leaving.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
http://sources.redhat.com/bugzilla/show_bug.cgi?id=311
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libc/311] dlclose doesn't close all dependent libraries
2004-08-07 21:21 [Bug libc/311] New: dlclose doesn't close all dependent libraries carlo at alinoe dot com
` (2 preceding siblings ...)
2004-08-17 14:19 ` carlo at alinoe dot com
@ 2005-07-08 16:26 ` drepper at redhat dot com
3 siblings, 0 replies; 5+ messages in thread
From: drepper at redhat dot com @ 2005-07-08 16:26 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From drepper at redhat dot com 2005-07-08 16:26 -------
I'm closing this bug since it's most likely fixed with the reference counting
mechanism which is implemented for a couple of months now. Reopen if necessary.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://sources.redhat.com/bugzilla/show_bug.cgi?id=311
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-07-08 16:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-07 21:21 [Bug libc/311] New: dlclose doesn't close all dependent libraries carlo at alinoe dot com
2004-08-09 8:26 ` [Bug libc/311] " jakub at redhat dot com
2004-08-17 14:16 ` carlo at alinoe dot com
2004-08-17 14:19 ` carlo at alinoe dot com
2005-07-08 16:26 ` drepper at redhat dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).