[ROOT] stack trace & TFile c'tor with const char filename with env var

From: Axel Naumann (naumann@hef.kun.nl)
Date: Tue Jul 22 2003 - 20:13:23 MEST


Hi,

I have three problems with root 3.05/06, cvs from 20 July 2003, gcc 3.2, 
linux, two of which nicely meet in the attached gdb backtrace.

1) I get a crash in the line
f = new 
TFile("$SRT_PRIVATE_CONTEXT/d0root_analysis/read_event/MBresolutionFunction_p13.root","read");
(within an Aclic compiled script)

I have no idea whether it's a correct guess, but I can't find a reason 
against it, so here's my hypothesis: If I open a 
TFile("$ENVVAR/test.root", "READ") first a SetName("$ENVVAR/test.root") 
is called. Then $ENVVAR is expanded, and SetName is called again, this 
time with the expanded version. Now "UnLink" is called on the old name, 
which in turn seems to call "delete []" - a bad idea for a stack const 
char. Some more info on the objects:

(gdb) frame 18
#18 0x4017aea2 in TStringRef::UnLink() (this=0x8b85ca0) at 
include/TString.h:386
386     { if (RemoveReference() == 0) delete [] (char*)this; }
Current language:  auto; currently c++

(gdb) print *this
$19 = {<TRefCnt> = {fRefs = 4294967295}, fCapacity = 79, fNchars = 77}

(gdb) frame 19
#19 0x40178c5a in TString::Replace(int, int, char const*, int) 
(this=0x8b85bd4, pos=0, n1=77,
     cs=0x8b86120 
"/home/naumann/work/frank_bid_fwk/d0root_analysis/read_event/MBresolutionFunction_p13.root", 
n2=89)
     at base/src/TString.cxx:588
588           Pref()->UnLink();

(gdb) print *this
$20 = {_vptr.TString = 0x405303e8, static fgInitialCapac = 15, static 
fgResizeInc = 16, static fgFreeboard = 15,
   fData = 0x8b85cac 
"$SRT_PRIVATE_CONTEXT/d0root_analysis/read_event/MBresolutionFunction_p13.root", 
static fgIsA = 0x8a4c8f0}

Could it be that the number of references is wrong? As you can see, I 
really don't have a clue what's happening inside TString's mem management...

2) the stack trace problem: Since a while (about 4 weeks, might be 
longer) I somtimes don't get a stack trace, instead root just hangs 
printing
  *** Break *** segmentation violation
  Generating stack trace...
as its last words. As you can see from the (gdb) stacktrace it seems to 
wait for some signal which never arrives. Any idea how that can happen? 
Is there something that I can do to help debug this?

3) If I do get a stack trace then c++filt seems unhappy with the 
binaries' gcc3 format. How can I teach it gnu-new-abi? nm points to 
where gcc is, and running e.g. the command 
"/fnal/ups/prd/gcc/Linux-2-4/v3_2_1/bin/addr2line -e 
/fnal/ups/prd/root/Linux-2-4/cvsdGCC_3_2_1_debug/lib/libCore.so 
0x000000000020d201" from the attached gdb stack trace gives me a nice 
"file name:line number" pair. But if triggered from within root I get (a 
stuck root session or) this:

root [14] ((TSystem*)new TString("ABJGDGD"))->Dump()

  *** Break *** illegal instruction
  Generating stack trace...
/fnal/ups/prd/gcc/Linux-2-4/v3_2_1/bin/c++filt: unknown demangling style 
`gnu-new-abi'

Any help or idea is appreciated!

Cheers, Axel.


---
#0  0x413daaa5 in __sigsuspend (set=0xbffe1350) at 
../sysdeps/unix/sysv/linux/sigsuspend.c:45
#1  0x4137c079 in __pthread_wait_for_restart_signal (self=0x41384d60) at 
pthread.c:967
#2  0x4137dd39 in __pthread_alt_lock (lock=0x414e0a40, self=0x0) at 
restart.h:34
#3  0x4137ac16 in __pthread_mutex_lock (mutex=0x414e0a30) at mutex.c:120
#4  0x4142b61d in ptmalloc_lock_all () at malloc.c:1624
#5  0x4137af42 in __vfork () at ptfork.c:74
#6  0x4141e93e in _IO_new_proc_open (fp=0x42a02640,
     command=0xbffe1bd0 
"/fnal/ups/prd/gcc/Linux-2-4/v3_2_1/bin/addr2line -e 
/fnal/ups/prd/root/Linux-2-4/cvsdGCC_3_2_1_debug/lib/libCore.so 
0x000000000020d201", mode=0x404f1de8 "r") at iopopen.c:155
#7  0x4141ecc0 in _IO_new_popen (
     command=0xbffe1bd0 
"/fnal/ups/prd/gcc/Linux-2-4/v3_2_1/bin/addr2line -e 
/fnal/ups/prd/root/Linux-2-4/cvsdGCC_3_2_1_debug/lib/libCore.so 
0x000000000020d201", mode=0x404f1de8 "r") at iopopen.c:231
#8  0x402253d9 in TUnixSystem::StackTrace() (this=0x8559108) at 
unix/src/TUnixSystem.cxx:1506
#9  0x40223b47 in TUnixSystem::DispatchSignals(ESignals) 
(this=0x8559108, sig=kSigSegmentationViolation) at 
unix/src/TUnixSystem.cxx:689
#10 0x40222a94 in SigHandler (sig=kSigSegmentationViolation) at 
unix/src/TUnixSystem.cxx:279
#11 0x40227041 in sighandler (sig=11) at unix/src/TUnixSystem.cxx:2455
#12 0x4137c8d5 in pthread_sighandler (signo=11, ctx=
       {gs = 7, __gsh = 0, fs = 0, __fsh = 0, es = 43, __esh = 0, ds = 
43, __dsh = 0, edi = 146300056, esi = 0, ebp = 3221104952, esp = 
3221104912, ebx = 1095639380, edx = 4294967295, ecx = 1095632416, eax = 
79, trapno = 14, err = 6, eip = 1094897308, cs = 35, __csh = 0, eflags = 
66182, esp_at_signal = 3221104912, ss = 43, __ssh = 0, fpstate = 
0xbffe2690, oldmask = 2147483648, cr2 = 11}) at signals.c:97
#13 <signal handler called>
#14 0x4142ce9c in chunk_free (ar_ptr=0x414e0620, p=0x8b85c98) at 
malloc.c:3228
#15 0x4142cbf4 in __libc_free (mem=0x8b85ca0) at malloc.c:3154
#16 0x404ce355 in operator delete(void*) (ptr=0xfffffffc) at 
../../../../../gcc-3.2.1/libstdc++-v3/libsupc++/del_op.cc:39
#17 0x404ce371 in operator delete[](void*) (ptr=0xfffffffc) at 
../../../../../gcc-3.2.1/libstdc++-v3/libsupc++/del_opv.cc:36
#18 0x4017aea2 in TStringRef::UnLink() (this=0x8b85ca0) at 
include/TString.h:386
#19 0x40178c5a in TString::Replace(int, int, char const*, int) 
(this=0x8b85bd4, pos=0, n1=77,
     cs=0x8b86120 
"/home/naumann/work/frank_bid_fwk/d0root_analysis/read_event/MBresolutionFunction_p13.root", 
n2=89)
     at base/src/TString.cxx:588
#20 0x4017818e in TString::operator=(char const*) (this=0x8b85bd4,
     cs=0x8b86120 
"/home/naumann/work/frank_bid_fwk/d0root_analysis/read_event/MBresolutionFunction_p13.root") 
at base/src/TString.cxx:348
#21 0x4015b7cb in TNamed::SetName(char const*) (this=0x8b85bc8,
     name=0x8b86120 
"/home/naumann/work/frank_bid_fwk/d0root_analysis/read_event/MBresolutionFunction_p13.root") 
at base/src/TNamed.cxx:133
#22 0x4013e820 in TFile (this=0x8b85bc8,
     fname1=0x42928c60 
"$SRT_PRIVATE_CONTEXT/d0root_analysis/read_event/MBresolutionFunction_p13.root", 
option=0x42928c2a "read",
     ftitle=0x42928c2f "", compress=1) at base/src/TFile.cxx:237



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET