From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,3f3af36550ec5560 X-Google-Attributes: gidfa528,public X-Google-Thread: ffc1e,3f3af36550ec5560 X-Google-Attributes: gidffc1e,public X-Google-ArrivalTime: 2000-09-08 04:02:21 PST Path: supernews.google.com!sn-xit-02!sn-east!supernews.com!news-feed.riddles.org.uk!newsfeed.direct.ca!look.ca!paloalto-snh1.gtei.net!paloalto-snf1.gtei.net!news.gtei.net!newsgate.tandem.com!mailint03.im.hou.compaq.com!pa.dec.com!ajo.zk3.dec.com!not-for-mail From: Dave Butenhof Newsgroups: comp.programming.threads,comp.unix.tru64 Subject: Re: SEGFAULT on Tru64 Date: Fri, 08 Sep 2000 06:58:00 -0400 Organization: Compaq Computer Corporation Message-ID: <39B8C638.FD9F5EF3@compaq.com> References: <39B8A896.6156719F@msa.dec.com> NNTP-Posting-Host: kalkin.zko.dec.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: lead.zk3.dec.com 968410668 380083 16.31.48.112 (8 Sep 2000 10:57:48 GMT) X-Complaints-To: iass@ajo.zk3.dec.com NNTP-Posting-Date: 8 Sep 2000 10:57:48 GMT X-Mailer: Mozilla 4.74 [en] (X11; U; OSF1 V5.0 alpha) X-Accept-Language: en Xref: supernews.google.com comp.programming.threads:535 comp.unix.tru64:311 Wai-Sun Chia wrote: > Here's a dbx/ladebug trace on my multithreaded server which always > segfaults within 10 minutes of run: > > This is on a Tru64 4.0f system. > > [cmd]$ ladebug cmd core > Welcome to the Ladebug Debugger Version 4.0-62 (built Jun 2 2000) > ------------------ > object file name: cmd > core file name: core > Reading symbolic information ...done > Core file produced from executable 'cmd' > Thread 0x3eb2 terminated at PC 0xa805c0f90 by signal SEGV > (ladebug) where > >0 0xa805c0f90 You've almost certainly corrupted your stack. With so little information, I can only do so much random guessing about how you might have done it, but I can offer a few tips. The places to start looking are writing through an uninitialized pointer, using out of scope shared data, (especially when one thread tries to share data on another thread's stack), or a misunderstanding of some API. The possibilities, unfortunately, are almost endless. Specifically, (though this may not help you much), you've very likely overwritten the saved RA (r26) of a stack frame, sending the thread into "hyperspace" when that frame tries to return. A great way to do this is to write (or cause an API to write) into a short data type via a pointer that was cast as if it pointed to a larger type. I used to see this a lot by people who tried to return the "void*" value of a pthread_join into an "int value", for example, carefully casting "&value" (pointer to a 32-bit value) to "(void**)&value" (pointer to a 64-bit value) to keep the compiler from complaining. This can easily happen a lot in code that was originally written using some of the bad assumptions people learn on 32-bit systems, but is less likely from people with some awareness of 64-bit programming. (Which is probably why I haven't seen this one for a long time.) /------------------[ David.Butenhof@compaq.com ]------------------\ | Compaq Computer Corporation http://members.aol.com/drbutenhof | | 110 Spit Brook Rd ZKO2-3/Q18, Nashua NH 03062-2698 | \--------[ http://www.awl.com/cseng/titles/0-201-63392-2/ ]-------/