Bug 1513

Summary: Elf-loader: thread unsafe
Product: dce Reporter: Hajime Tazaki <tazaki>
Component: otherAssignee: Hajime Tazaki <tazaki>
Status: CONFIRMED ---    
Severity: normal CC: ns-bugs, tazaki
Priority: P2    
Version: unspecified   
Hardware: All   
OS: All   

Description Hajime Tazaki 2012-10-16 03:06:15 EDT
under the following version:
% hg head
changeset:   309:957c0c1b6549
tag:         tip

on Ubuntu 1004 64bits (seems to be same in the other environments).

PthreadFiberManager is used with elf-loader, dlclose() causes a crash.


To reproduce this,

% NS_ATTRIBUTE_DEFAULT='ns3::DceManagerHelper::LoaderFactory=ns3::CoojaLoaderFactory[];ns3::TaskManager::FiberManagerType=PthreadFiberManager' ./build/bin/ns3test-dce-vdl

(gdb) bt
#0  0x00007fc1e1a6c11d in vdl_gc_white_list_new (list=0x7fc1e1c748b8)
    at /home/tazaki/hgworks/ns-3-dce-thehajime/elf-loader/vdl-gc.c:52
#1  0x00007fc1e1a6c2d3 in vdl_gc_run ()
    at /home/tazaki/hgworks/ns-3-dce-thehajime/elf-loader/vdl-gc.c:99
#2  0x00007fc1e1a762e1 in vdl_dlclose (handle=0x7fc1e1c4b8c8)
    at /home/tazaki/hgworks/ns-3-dce-thehajime/elf-loader/vdl-dl.c:342
#3  0x00007fc1e1a7736e in vdl_dlclose_public (handle=0x7fc1e1c4b8c8)
    at /home/tazaki/hgworks/ns-3-dce-thehajime/elf-loader/vdl-dl-public.c:21
#4  0x00007fc1df058c49 in dlclose (handle=0x7fc1e1c4b8c8)
    at /home/tazaki/hgworks/ns-3-dce-thehajime/elf-loader/libvdl.c:30
#5  0x00007fc1e179ca2c in UnrefSharedModule (this=0x1fc8290, search=0x1fcb620)
    at ../model/cooja-loader-factory.cc:310
#6  0x00007fc1e179c9e6 in UnrefSharedModule (this=0x1fc8290, search=0x1fc6070)
    at ../model/cooja-loader-factory.cc:308
#7  0x00007fc1e179ce1c in ns3::CoojaLoader::UnloadAll (this=0x1fc8290)
    at ../model/cooja-loader-factory.cc:331
#8  0x00007fc1e1766e65 in dce_exit (status=0) at ../model/dce-pthread.cc:86
#9  0x00007fc1e1701f8a in ns3::DceManager::DoStartProcess (context=0x1fc8620)
    at ../model/dce-manager.cc:285
#10 0x00007fc1e178a4d6 in ns3::TaskManager::Trampoline (context=0x1fc80f0)
    at ../model/task-manager.cc:250
#11 0x00007fc1e1785b43 in ns3::PthreadFiberManager::Run (arg=0x1fc8930)
    at ../model/pthread-fiber-manager.cc:398
#12 0x00007fc1df5e49ca in start_thread (arg=<value optimized out>) at pthread_create.c:300
#13 0x00007fc1df341cdd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#14 0x0000000000000000 in ?? ()