fork problem in multithreaded process -- segmentation fault seen

dev nath dev_wip_bms@yahoo.com
Fri Mar 5 01:19:00 GMT 2010


Hi *, 

I am facing a seg fault with the backtrace as below. Not sure if this is a kernel problem or glibc problem or something in the application.
 
This problem is similar to the one listed in the below URL
http://lkml.indiana.edu/hypermail/linux/kernel/9908.0/0486.html
 
Explanation of the scenario:
----------------------------
A multiple threaded process tries to fork another process and the application crashes at fork () api.  glibc-2.3.3 is used. I have ensured that the application is not doing anything between fork() and exec() api. In the pthread_mutex_init call the mutex variable seems NULL and not sure if this is something related to streams. 
 
Please help me with the problem.
 
 
 
 
Loaded symbols for /opt/montavista/pro/devkit/ppc/7xx/target/lib/libnss_files.so.2
#0  *__GI___pthread_mutex_init (mutex=0x0, mutex_attr=0x257ffe78) at spinlock.h:102
102     spinlock.h: No such file or directory.
        in spinlock.h
(gdb) bt
#0  *__GI___pthread_mutex_init (mutex=0x0, mutex_attr=0x257ffe78) at spinlock.h:102
#1  0x0f9af820 in __fresetlockfiles () at lockfile.c:77
#2  0x0f9ad59c in __pthread_fork (b=0xfb4eef8) at ptfork.c:51
#3  0x0faaaa20 in __libc_fork () at ../linuxthreads/sysdeps/unix/sysv/linux/fork.c:39
#4  0x100e8f80 in pn_exec_XXXX () at XXXX_pim_msgq_YYY_thread.c:714
#5  0x100131bc in PN_PI_ThreadStarter (theArg=0x0) at pn_pi.c:377
#6  0x0f9abd48 in pthread_start_thread (arg=0x0) at manager.c:310
#7  0x0fadc228 in ?? () at ../sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S:94
   from /opt/montavista/pro/devkit/ppc/777/target/lib/libc.so.6
warning: Previous frame inner to this frame (corrupt stack?)
(gdb) frame 0
#0  *__GI___pthread_mutex_init (mutex=0x0, mutex_attr=0x257ffe78) at spinlock.h:102
102     in spinlock.h
(gdb) frame 1
#1  0x0f9af820 in __fresetlockfiles () at lockfile.c:77
77      lockfile.c: No such file or directory.
        in lockfile.c
(gdb) list
72      in lockfile.c
(gdb) p *attr
Structure has no component named operator*.
(gdb) p attr
$1 = {__mutexkind = 1}
(gdb) p i
$2 = 0x224ee690
(gdb) p *i
$3 = {_flags = -72503612, _IO_read_ptr = 0x238f1000 "", _IO_read_end = 0x238f1000 "",
  _IO_read_base = 0x238f1000 "", _IO_write_base = 0x238f1000 "", _IO_write_ptr = 0x238f1000 "",
  _IO_write_end = 0x238f1000 "", _IO_buf_base = 0x238f1000 "",
  _IO_buf_end = 0x238f2000 <Address 0x238f2000 out of bounds>, _IO_save_base = 0x0,
  _IO_backup_base = 0x0, _IO_save_end = 0x0, _markers = 0x0, _chain = 0x10270708, _fileno = 48,
  _flags2 = 0, _old_offset = 0, _cur_column = 0, _vtable_offset = 0 '\0', _shortbuf = "",
  _lock = 0x0, _offset = -1, _codecvt = 0x0, _wide_data = 0x224ee730, _mode = -1,
  _unused2 = '\0' <repeats 40 times>, "\"Nè°\000\000\000\001\020\000\000"}






More information about the Libc-help mailing list