🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #1202

gdb on Linux gets SIGSEGV in a "zombie thread"

#1202
From: Jonathan Beit-Aharon
Date: Mon, 23 Jan 2006 16:29
287 lines
15740 bytes
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
Hi,<br>
Debugging a large daemon program (being ported from FreeBSD to
Linux), I'm using gdb on Linux, and receiving the message:<br>
&nbsp;&nbsp;&nbsp; Program received signal SIGSEGV, Segmentation fault.<br>
&nbsp;&nbsp;&nbsp; [Switching to Thread 155540400 (zombie)]<br>
&nbsp;&nbsp;&nbsp; 0x0031a18b in malloc_consolidate () from /lib/tls/libc.so.6<br>
<br>
The backtrace shows a thread program stack that is not shown by the
"thread apply all bt", so I assume this is the bt of the "zombie
thread".&nbsp; What is a zombie thread?<br>
<br>
A zombie process, if I understand correctly, is one all of whose
resources have been reclaimed by the kernel, except for a few kernel
structures that are kept for the sake of statistics relevant to other
processes.&nbsp; This zombie, however, seems to still have an active program
stack, and the chutzpah to abort.&nbsp; How can I trace a thread that
doesn't appear in the backtrace?<br>
<br>
This is unique to **gdb on Linux**, because debugging the same modified
code on FreeBSD exposed a bug (order of precedence in
*ppcCharStrings[kk]=0; assignment), happening about 20 C-statements
before the SIGSEGV.<br>
<br>
I'm including below much detail in the hope that it might help fix gdb.<br>
Thank you for a wonderful tool,<br>
Jonathan :-)<br>
<br>
The system characteristics are:<br>
&nbsp;&nbsp;&nbsp; root@bumper:~ $uname -a<br>
&nbsp;&nbsp;&nbsp; Linux bumper.cybertron.intrusic.com 2.6.12-1.1381_FC3 #1 Fri Oct 21
03:46:55 EDT 2005 i686 i686 i386 GNU/Linux<br>
&nbsp;&nbsp;&nbsp; root@bumper:~ $gcc --version<br>
&nbsp;&nbsp;&nbsp; gcc (GCC) 3.4.4 20050721 (Red Hat 3.4.4-2)<br>
&nbsp;&nbsp;&nbsp; Copyright (C) 2004 Free Software Foundation, Inc.<br>
&nbsp;&nbsp;&nbsp; This is free software; see the source for copying conditions.&nbsp;
There is NO<br>
&nbsp;&nbsp;&nbsp; warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.<br>
<br>
Here is my debug session:<br>
<br>
root@bumper:/home/jbeitaharon/dev/manhattan/bin $gdb dlbr<br>
GNU gdb Red Hat Linux (6.1post-1.20040607.43.0.1rh)<br>
Copyright 2004 Free Software Foundation, Inc.<br>
GDB is free software, covered by the GNU General Public License, and
you are<br>
welcome to change it and/or distribute copies of it under certain
conditions.<br>
Type "show copying" to see the conditions.<br>
There is absolutely no warranty for GDB.&nbsp; Type "show warranty" for
details.<br>
This GDB was configured as "i386-redhat-linux-gnu"...Using host
libthread_db library "/lib/tls/libthread_db.so.1".<br>
<br>
(gdb) b _ChunkInsert<br>
Breakpoint 1 at 0x804bb8b: file dlbr_exchange.c, line 477.<br>
(gdb) r -D<br>
Starting program: /home/jbeitaharon/dev/manhattan/bin/dlbr -D<br>
Reading symbols from shared object read from target memory...done.<br>
Loaded system supplied DSO at 0xa8c000<br>
[Thread debugging using libthread_db enabled]<br>
[New Thread -1208940160 (LWP 32742)]<br>
[New Thread 26168240 (LWP 304)]<br>
[New Thread 99670960 (LWP 305)]<br>
32742 | utils.thrd.thrd_parent | LOG_DEBUG | thrd_parent.c : 372 | Wed
Jan 18 16:07:38 2006 | Parent started |<br>
32742 | utils.thrd.thrd_parent | LOG_DEBUG | thrd_parent.c : 747 | Wed
Jan 18 16:07:38 2006 | Parent event loop started |<br>
[New Thread 123161520 (LWP 306)]<br>
[New Thread 36658096 (LWP 307)]<br>
32742 | utils.thrd.thrd_child | LOG_ERROR | thrd_child.c : 1086 | Wed
Jan 18 16:09:26 2006 |<br>
Error reading current virtual memory size:<br>
(null) |<br>
32742 | utils.conf.conf | LOG_INFO | conf.c : 492 | Wed Jan 18 16:09:26
2006 |<br>
Configuration loaded<br>
32742 | utils.conf.conf | LOG_INFO | conf.c : 492 | Wed Jan 18 16:09:56
2006 |<br>
Configuration loaded<br>
CONF: /storage/pcap and /storage/evidence quotas (5000 + 1000 MB)
within available space (7317 MB free + 0 MB already used for data and
evidence)<br>
[New Thread 47147952 (LWP 18185)]<br>
32742 | utils.thrd.thrd_parent | LOG_DEBUG | thrd_parent.c : 747 | Wed
Jan 18 16:17:09 2006 | Parent event loop started |<br>
[New Thread 57637808 (LWP 18186)]<br>
[New Thread 68127664 (LWP 18187)]<br>
[New Thread 82631600 (LWP 18188)]<br>
[New Thread 110160816 (LWP 18189)]<br>
[New Thread 133651376 (LWP 18190)]<br>
32742 | utils.thrd.thrd_parent | LOG_DEBUG | thrd_parent.c : 747 | Wed
Jan 18 16:17:09 2006 | Parent event loop started |<br>
[New Thread 145050544 (LWP 2789)]<br>
[New Thread 155540400 (LWP 2791)]<br>
32742 | utils.thrd.thrd_child | LOG_DEBUG | thrd_child.c : 1623 | Wed
Jan 18 16:58:33 2006 | [dlbr.exchange.conn] Processing own child finish
event |<br>
<br>
Program received signal SIGSEGV, Segmentation fault.<br>
[Switching to Thread 155540400 (zombie)]<br>
0x0031a18b in malloc_consolidate () from /lib/tls/libc.so.6<br>
(gdb) bt<br>
#0&nbsp; 0x0031a18b in malloc_consolidate () from /lib/tls/libc.so.6<br>
#1&nbsp; 0x0031b1c3 in _int_malloc () from /lib/tls/libc.so.6<br>
#2&nbsp; 0x0031ccf6 in calloc () from /lib/tls/libc.so.6<br>
#3&nbsp; 0x00658161 in _dl_new_object () from /lib/ld-linux.so.2<br>
#4&nbsp; 0x006545b9 in _dl_map_object_from_fd () from /lib/ld-linux.so.2<br>
#5&nbsp; 0x0065605c in _dl_map_object () from /lib/ld-linux.so.2<br>
#6&nbsp; 0x003b4738 in dl_open_worker () from /lib/tls/libc.so.6<br>
#7&nbsp; 0x00000000 in ?? ()<br>
(gdb) thread apply all bt<br>
<br>
Thread 12 (Thread 145050544 (LWP 2789)):<br>
#0&nbsp; 0x00a8c402 in __kernel_vsyscall ()<br>
#1&nbsp; 0x003718db in __write_nocancel () from /lib/tls/libc.so.6<br>
#2&nbsp; 0x00316d6f in _IO_new_file_write () from /lib/tls/libc.so.6<br>
#3&nbsp; 0x003157cb in _IO_new_do_write () from /lib/tls/libc.so.6<br>
#4&nbsp; 0x00316278 in _IO_new_file_overflow () from /lib/tls/libc.so.6<br>
#5&nbsp; 0x00316e92 in _IO_new_file_xsputn () from /lib/tls/libc.so.6<br>
#6&nbsp; 0x002f38a7 in vfprintf () from /lib/tls/libc.so.6<br>
#7&nbsp; 0x002fb40f in fprintf () from /lib/tls/libc.so.6<br>
#8&nbsp; 0x006dbc50 in THRD_LogMsg (strCategory=0x6dffa5
"utils.thrd.thrd_child",<br>
&nbsp;&nbsp;&nbsp; tLogLevel=7, strFileName=0x6dfe18 "thrd_child.c", iLineNumber=1623,<br>
&nbsp;&nbsp;&nbsp; strFormat=0x6e0088 "[%s] Processing own child finish event")<br>
&nbsp;&nbsp;&nbsp; at thrd_child.c:1050<br>
#9&nbsp; 0x006dc5a4 in _THRD_ChildEventProcess (pstChild=0x9f60e98)<br>
&nbsp;&nbsp;&nbsp; at thrd_child.c:1622<br>
#10 0x006dc328 in _THRD_ChildEventStart (pvArg=0x9f60e98) at
thrd_child.c:1500<br>
#11 0x008a5341 in start_thread () from /lib/tls/libpthread.so.0<br>
#12 0x003806fe in clone () from /lib/tls/libc.so.6<br>
<br>
Thread 11 (Thread 133651376 (LWP 18190)):<br>
#0&nbsp; 0x00a8c402 in __kernel_vsyscall ()<br>
#1&nbsp; 0x008a7a86 in <a class="moz-txt-link-abbreviated"
 href="mailto:pthread_cond_wait@@GLIBC_2.3.2">pthread_cond_wait@@GLIBC_2.3.2</a>
()<br>
---Type &lt;return&gt; to continue, or q &lt;return&gt; to quit---<br>
&nbsp;&nbsp; from /lib/tls/libpthread.so.0<br>
#2&nbsp; 0x006da68c in Pthread_Cond_Wait (cond=0x9f60c20, mutex=0x9f60b40)<br>
&nbsp;&nbsp;&nbsp; at thrd_pthread.c:243<br>
#3&nbsp; 0x006d9c99 in _THRD_ParentEventStart (pvArg=0x9f60b40) at
thrd_parent.c:754<br>
#4&nbsp; 0x008a5341 in start_thread () from /lib/tls/libpthread.so.0<br>
#5&nbsp; 0x003806fe in clone () from /lib/tls/libc.so.6<br>
<br>
Thread 10 (Thread 110160816 (LWP 18189)):<br>
#0&nbsp; 0x00a8c402 in __kernel_vsyscall ()<br>
#1&nbsp; 0x003435b6 in __nanosleep_nocancel () from /lib/tls/libc.so.6<br>
#2&nbsp; 0x003433bc in sleep () from /lib/tls/libc.so.6<br>
#3&nbsp; 0x006dabdd in Pthread_Cleanup_Pop (execute=0) at thrd_pthread.c:467<br>
#4&nbsp; 0x006dba52 in THRD_LockPop (ptMutex=0x9f0f99c) at thrd_child.c:945<br>
#5&nbsp; 0x0804c682 in DLBR_FormatStart (pvArg=0x9f5fc38) at
dlbr_format.c:340<br>
#6&nbsp; 0x008a5341 in start_thread () from /lib/tls/libpthread.so.0<br>
#7&nbsp; 0x003806fe in clone () from /lib/tls/libc.so.6<br>
<br>
Thread 9 (Thread 82631600 (LWP 18188)):<br>
#0&nbsp; 0x00a8c402 in __kernel_vsyscall ()<br>
#1&nbsp; 0x00379151 in ___newselect_nocancel () from /lib/tls/libc.so.6<br>
#2&nbsp; 0x00ce32e0 in NETX_ExchangeStart (pstExchange=0x9f600a0)<br>
&nbsp;&nbsp;&nbsp; at netx_exchange.c:377<br>
#3&nbsp; 0x0804b8b7 in DLBR_ExchangeStart (pvArg=0x9f5fa68) at
dlbr_exchange.c:384<br>
---Type &lt;return&gt; to continue, or q &lt;return&gt; to quit---<br>
#4&nbsp; 0x008a5341 in start_thread () from /lib/tls/libpthread.so.0<br>
#5&nbsp; 0x003806fe in clone () from /lib/tls/libc.so.6<br>
<br>
Thread 8 (Thread 68127664 (LWP 18187)):<br>
#0&nbsp; 0x00a8c402 in __kernel_vsyscall ()<br>
#1&nbsp; 0x008a7a86 in <a class="moz-txt-link-abbreviated"
 href="mailto:pthread_cond_wait@@GLIBC_2.3.2">pthread_cond_wait@@GLIBC_2.3.2</a>
()<br>
&nbsp;&nbsp; from /lib/tls/libpthread.so.0<br>
#2&nbsp; 0x006da68c in Pthread_Cond_Wait (cond=0x9f5fd78, mutex=0x9f5fc38)<br>
&nbsp;&nbsp;&nbsp; at thrd_pthread.c:243<br>
#3&nbsp; 0x006dc2d7 in _THRD_ChildEventStart (pvArg=0x9f5fc38) at
thrd_child.c:1491<br>
#4&nbsp; 0x008a5341 in start_thread () from /lib/tls/libpthread.so.0<br>
#5&nbsp; 0x003806fe in clone () from /lib/tls/libc.so.6<br>
<br>
Thread 7 (Thread 57637808 (LWP 18186)):<br>
#0&nbsp; 0x00a8c402 in __kernel_vsyscall ()<br>
#1&nbsp; 0x008a7a86 in <a class="moz-txt-link-abbreviated"
 href="mailto:pthread_cond_wait@@GLIBC_2.3.2">pthread_cond_wait@@GLIBC_2.3.2</a>
()<br>
&nbsp;&nbsp; from /lib/tls/libpthread.so.0<br>
#2&nbsp; 0x006da68c in Pthread_Cond_Wait (cond=0x9f5fb20, mutex=0x9f5fa68)<br>
&nbsp;&nbsp;&nbsp; at thrd_pthread.c:243<br>
#3&nbsp; 0x006dc2d7 in _THRD_ChildEventStart (pvArg=0x9f5fa68) at
thrd_child.c:1491<br>
#4&nbsp; 0x008a5341 in start_thread () from /lib/tls/libpthread.so.0<br>
#5&nbsp; 0x003806fe in clone () from /lib/tls/libc.so.6<br>
<br>
---Type &lt;return&gt; to continue, or q &lt;return&gt; to quit---<br>
Thread 6 (Thread 47147952 (LWP 18185)):<br>
#0&nbsp; 0x00a8c402 in __kernel_vsyscall ()<br>
#1&nbsp; 0x008a7a86 in <a class="moz-txt-link-abbreviated"
 href="mailto:pthread_cond_wait@@GLIBC_2.3.2">pthread_cond_wait@@GLIBC_2.3.2</a>
()<br>
&nbsp;&nbsp; from /lib/tls/libpthread.so.0<br>
#2&nbsp; 0x006da68c in Pthread_Cond_Wait (cond=0x9f5f8a8, mutex=0x9f5f7c8)<br>
&nbsp;&nbsp;&nbsp; at thrd_pthread.c:243<br>
#3&nbsp; 0x006d9c99 in _THRD_ParentEventStart (pvArg=0x9f5f7c8) at
thrd_parent.c:754<br>
#4&nbsp; 0x008a5341 in start_thread () from /lib/tls/libpthread.so.0<br>
#5&nbsp; 0x003806fe in clone () from /lib/tls/libc.so.6<br>
<br>
Thread 5 (Thread 36658096 (LWP 307)):<br>
#0&nbsp; 0x00a8c402 in __kernel_vsyscall ()<br>
#1&nbsp; 0x003435b6 in __nanosleep_nocancel () from /lib/tls/libc.so.6<br>
#2&nbsp; 0x003433bc in sleep () from /lib/tls/libc.so.6<br>
#3&nbsp; 0x0804a07b in DLBR_Run (pvArg=0x9e3b468) at dlbr.c:381<br>
#4&nbsp; 0x008a5341 in start_thread () from /lib/tls/libpthread.so.0<br>
#5&nbsp; 0x003806fe in clone () from /lib/tls/libc.so.6<br>
<br>
Thread 4 (Thread 123161520 (LWP 306)):<br>
#0&nbsp; 0x00a8c402 in __kernel_vsyscall ()<br>
#1&nbsp; 0x008a7a86 in <a class="moz-txt-link-abbreviated"
 href="mailto:pthread_cond_wait@@GLIBC_2.3.2">pthread_cond_wait@@GLIBC_2.3.2</a>
()<br>
&nbsp;&nbsp; from /lib/tls/libpthread.so.0<br>
#2&nbsp; 0x006da68c in Pthread_Cond_Wait (cond=0x9e3b5a8, mutex=0x9e3b468)<br>
---Type &lt;return&gt; to continue, or q &lt;return&gt; to quit---<br>
&nbsp;&nbsp;&nbsp; at thrd_pthread.c:243<br>
#3&nbsp; 0x006dc2d7 in _THRD_ChildEventStart (pvArg=0x9e3b468) at
thrd_child.c:1491<br>
#4&nbsp; 0x008a5341 in start_thread () from /lib/tls/libpthread.so.0<br>
#5&nbsp; 0x003806fe in clone () from /lib/tls/libc.so.6<br>
<br>
Thread 3 (Thread 99670960 (LWP 305)):<br>
#0&nbsp; 0x00a8c402 in __kernel_vsyscall ()<br>
#1&nbsp; 0x008a7a86 in <a class="moz-txt-link-abbreviated"
 href="mailto:pthread_cond_wait@@GLIBC_2.3.2">pthread_cond_wait@@GLIBC_2.3.2</a>
()<br>
&nbsp;&nbsp; from /lib/tls/libpthread.so.0<br>
#2&nbsp; 0x006da68c in Pthread_Cond_Wait (cond=0x9e3b2c0, mutex=0x9e3b1e0)<br>
&nbsp;&nbsp;&nbsp; at thrd_pthread.c:243<br>
#3&nbsp; 0x006d9c99 in _THRD_ParentEventStart (pvArg=0x9e3b1e0) at
thrd_parent.c:754<br>
#4&nbsp; 0x008a5341 in start_thread () from /lib/tls/libpthread.so.0<br>
#5&nbsp; 0x003806fe in clone () from /lib/tls/libc.so.6<br>
<br>
Thread 2 (Thread 26168240 (LWP 304)):<br>
#0&nbsp; 0x00a8c402 in __kernel_vsyscall ()<br>
#1&nbsp; 0x008ab51e in do_sigwait () from /lib/tls/libpthread.so.0<br>
#2&nbsp; 0x008ab5bf in sigwait () from /lib/tls/libpthread.so.0<br>
#3&nbsp; 0x004e72af in BINW_SigWaiter (arg=0xbfa19050) at binw.c:330<br>
#4&nbsp; 0x008a5341 in start_thread () from /lib/tls/libpthread.so.0<br>
#5&nbsp; 0x003806fe in clone () from /lib/tls/libc.so.6<br>
<br>
---Type &lt;return&gt; to continue, or q &lt;return&gt; to quit---<br>
Thread 1 (Thread -1208940160 (LWP 32742)):<br>
#0&nbsp; 0x00a8c402 in __kernel_vsyscall ()<br>
#1&nbsp; 0x003435b6 in __nanosleep_nocancel () from /lib/tls/libc.so.6<br>
#2&nbsp; 0x003433bc in sleep () from /lib/tls/libc.so.6<br>
#3&nbsp; 0x004e71b2 in BINW_Wrap (argc=2, argv=0xbfa191c4,<br>
&nbsp;&nbsp;&nbsp; strVersion=0x804e7f8 "datalibrarian v1.0",<br>
&nbsp;&nbsp;&nbsp; strPidDefault=0x804e7ed "./dlbr.pid", strService=0x804e7e8 "dlbr",<br>
&nbsp;&nbsp;&nbsp; pfnService=0x8049f60 &lt;DLBR_Run&gt;) at binw.c:272<br>
#4&nbsp; 0x08049f42 in main (argc=2, argv=0xbfa191c4) at dlibrarian.c:64<br>
(gdb) thread 10<br>
[Switching to thread 10 (Thread 110160816 (LWP 18189))]#0&nbsp; 0x00a8c402
in __kernel_vsyscall ()<br>
(gdb) n<br>
Single stepping until exit from function __kernel_vsyscall,<br>
which has no line number information.<br>
<br>
-- <br>
After the last two response lines from gdb the process is hung.<br>
Thanks again,<br>
Jonathan<br>
<br>
<br>
</body>
</html>
Technical Details
Message-ID: <mailman.2228.1138034631.26925.bug-gdb@gnu.org>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news3.google.com!newsfeed.stanford.edu!shelby.stanford.edu!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: f5053,549f5b38e3964442,start
X-Google-Attributes: gidf5053,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news3.google.com!newsfeed.stanford.edu!shelby.stanford.edu!not-for-mail
From: Jonathan Beit-Aharon <jbeitaharon@intrusic.com>
Newsgroups: gnu.gdb.bug
Subject: gdb on Linux gets SIGSEGV in a "zombie thread"
Date: Mon, 23 Jan 2006 11:29:05 -0500
Organization: Intrusic, Inc.
Lines: 289
Approved: bug-gdb@gnu.org
Message-ID: <mailman.2228.1138034631.26925.bug-gdb@gnu.org>
NNTP-Posting-Host: lists.gnu.org
Mime-Version: 1.0
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news.Stanford.EDU 1138034468 3117 199.232.76.165 (23 Jan 2006 16:41:08 GMT)
X-Complaints-To: news@news.stanford.edu
To: Bug-gdb@gnu.org
Envelope-to: bug-gdb@gnu.org
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
 rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1
X-Accept-Language: en-us, en, he
X-BeenThere: bug-gdb@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "Bug reports for GDB, the GNU debugger" <bug-gdb.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-gdb>,
 <mailto:bug-gdb-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/bug-gdb>
List-Post: <mailto:bug-gdb@gnu.org>
List-Help: <mailto:bug-gdb-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-gdb>,
 <mailto:bug-gdb-request@gnu.org?subject=subscribe>