bug-libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

multiple load/unload of modules crashes


From: Tod Milam
Subject: multiple load/unload of modules crashes
Date: Wed, 13 Dec 2000 14:19:16 -0600

Current daily snapshot of libtool (libtool-20001213.tar.gz).
% uname -a
Linux bucky.traclabs.com 2.2.14-5.0 #4 Wed Jun 28 14:17:06 CDT 2000 i686
unknown

My app loads 4 modules, unloads them, then attempts to load another. 
For each module loaded it calls lt_dlinit() and for each unload it calls
lt_dlexit().  When attempting to load a module after all others have
been unloaded a crash occurs:
(gdb) where
#0  0x40168d88 in main_arena () from /lib/libc.so.6
#1  0x4001a42b in tryall_dlopen (handle=0xbffff574, 
    filename=0x8054a10 "rlogNull.a") at ltdl.c:1199
#2  0x4001a47f in find_module (handle=0xbffff574, 
    dir=0x8054518 "/usr/local/lib/", libdir=0x8054a20 "/usr/local/lib", 
    dlname=0x8054a00 "rlogNull.so", old_name=0x8054a10 "rlogNull.a", 
    installed=1) at ltdl.c:1238
#3  0x4001bb4c in lt_dlopen (filename=0x80544d8
"/usr/local/lib/rlogNull.la")
    at ltdl.c:1972
#4  0x4001be8d in lt_dlopenext (filename=0xbffff614
"/usr/local/lib/rlogNull")
    at ltdl.c:2090
#5  0x40019351 in _rlogInitDest (argc=1, argv=0xbffff964, 
    type=0x80494e1 "app1dest5", argp=0xbffff8ec) at rlogDests.c:88
#6  0x400170fd in rlogInitType (argc=1, argv=0xbffff964, 
    type=0x80494e1 "app1dest5") at rlog.c:50
#7  0x8048d52 in main (argc=1, argv=0xbffff964) at SampleApp.c:186

I tracked it down to the loaders static variable not being reset to 0
after all of the loaders had been removed.  The following patch fixed my
problem:

% diff -U5 ltdl.c.orig ltdl.c     
--- ltdl.c.orig Wed Dec 13 11:20:26 2000
+++ ltdl.c      Wed Dec 13 11:20:45 2000
@@ -1136,10 +1136,11 @@
            }
 
          lt_dlfree (loader);
          loader = next;
        }
+      loaders = 0;
     }
 
   return errors;
 }

I have tested this on Linux and FreeBSD, although I don't think FreeBSD
had the same problem before the fix (don't remember for sure).

Tod

Tod Milam
Metrica, Inc.
Texas Robotics & Automation Center
http://www.traclabs.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]