Crash on execution after second compilation

Dear experts,

I have a macro that compiles fine and runs fine–only the first time! A second compilation appears successful, only to discover that any commands issued after that will segfault, after which must quit with “.qqqqqq”.

It seems that the issue is related to the line

but I wonder what could cause it to run just fine only once.

I made sure do delete all the pointers, files, at the end of the macro. I preferred not to post the entire code unless you think it will help, but I can certainly do that.

Many thanks,

– Nil

[code] root [0] .L SpikeAnalyzer.cxx++
Info in TUnixSystem::ACLiC: creating shared library /afs/cern.ch/user/n/nvallsve/CMSSW_3_8_1/src/UserCode/H2TB2010Spikes/test/SpikeAnalyzer/./SpikeAnalyzer_cxx.so
/usr/bin/ld: skipping incompatible /usr/lib64/libm.so when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib64/libm.a when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib64/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib64/libc.a when searching for -lc
root [1] SpikeAnalyzer(“sample.root”);
Macro started. Entries in chain: 15000
======> EVENT:10
size = 5
chId = (vector)0xa131638
swissCross = (vector
)0xa132978
amplitude = (vector)0xa1329b8
energy = (vector
)0xa133878
time = (vector)0xac7d1b0
timeError = (vector
)0xa1353d8
flag = (vector)0xa135820
chi2 = (vector
)0xa135830
samples = (vector<vector >*)0xac7b830

=== DONE ===

root [2] .L SpikeAnalyzer.cxx++
Info in : unmodified script has already been compiled and loaded
Info in : it will be regenerated and reloaded!
Info in TUnixSystem::ACLiC: creating shared library /afs/cern.ch/user/n/nvallsve/CMSSW_3_8_1/src/UserCode/H2TB2010Spikes/test/SpikeAnalyzer/./SpikeAnalyzer_cxx.so
/usr/bin/ld: skipping incompatible /usr/lib64/libm.so when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib64/libm.a when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib64/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib64/libc.a when searching for -lc
root [3] SpikeAnalyzer(“sample.root”);
Error: Function SpikeAnalyzer(“sample.root”) is not defined in current scope (tmpfile):1:
*** Interpreter error recovered ***
root [4] gSystem->Unload(“SpikeAnalyzer_cxx.so”);
*** Break *** segmentation violation
Attaching to program: /proc/14923/exe, process 14923
[Thread debugging using libthread_db enabled]

[/code]

do not call gSystem->Unload(“SpikeAnalyzer_cxx.so”);
If you want to rerun, simply call
.L SpikeAnalyzer.cxx+

Rene

Hi Rene,

Thanks for the quick reply.

In fact, gSystem->Unload was an attempt to find a partial solution. Notice how on my output I do call .L SpikeAnalyzer.cxx+ a second time, but then it does no longer know about the function.

root [3] SpikeAnalyzer("sample.root");  // Function call after second compilation
Error: Function SpikeAnalyzer("sample.root") is not defined in current scope

Thanks,

– Nil

Could you post the smallest possible setup (script + data file) reproducing your problem?

Rene

Hi Rene,

I’ve placed the code and a sample ntuple in my public afs space:
/afs/cern.ch/user/n/nvallsve/public/SpikeAnalyzer/

You can also see the code and the exact commands issued with their outputs here:
http://cern.ch/nvalls/h2tb2010/SpikeAnalyzer/

Thanks for your help,

– Nil

your directory /afs/cern.ch/user/n/nvallsve/public/SpikeAnalyzer/ is not public readable

Rene

Sorry about that. I turned it readable and verified it with a different username.

Philippe will investigate later

Rene

Hi,

I am confused. With the code on afs, the message [quote]root [3] SpikeAnalyzer(“sample.root”);
Error: Function SpikeAnalyzer(“sample.root”) is not defined in current scope (tmpfile):1:
*** Interpreter error recovered ***[/quote]is seemingly accurate:$ grep SpikeAnalyzer *.cxx *.h SpikeAnalyzer.cxx:#include "SpikeAnalyzer.h" SpikeAnalyzer.cxx:void SpikeAnalyzer(){ SpikeAnalyzer.h:void SpikeAnalyzer();So I am guessing that the problem might be coming from the fact that you might have 2 files name SpikeAnalyzer.cxx that conflicts with each other.

Cheers,
Philippe.

Hi Phillipe,

Thanks for looking into this. Only one SpikeAnalyzer.cxx and one SpikeAnalyzer.h exist. What you see on your grep output is:

$ grep SpikeAnalyzer *.cxx *.h
SpikeAnalyzer.cxx:#include “SpikeAnalyzer.h” ==> Sourcing the header file "SpikeAnalyzer.h"
SpikeAnalyzer.cxx:void SpikeAnalyzer(){ ==> Function declaration in cxx file
SpikeAnalyzer.h:void SpikeAnalyzer(); ==> Function prototype in header file

As I pointed out, the problem occurs when TChain::GetEntry(n) is called. If such call is commented out, there is no problem in compiling and executing multiple times within the same ROOT session. I even tried deleting all the pointers and TFiles at the end of SpikeAnalyzer(), but that didn’t solve anything. I’m very puzzled…

Thanks,

– Nil

Hi Nil,

In your example:root [3] SpikeAnalyzer("sample.root"); you pass a parameter to the function … which does not take any argument. Can you send me again a complete output of the failed run with the correct syntax so that I can reproduce it.

Thanks,
Philippe.

Sorry Phillipe, that output was form an older version. Here’s a detailed output that I just obtained now with the exact code present in my public afs space:

$ cd ~/CMSSW_3_8_1/src/
$ cmsenv
$ cd /afs/cern.ch/user/n/nvallsve/public/SpikeAnalyzer/
$ root -l
root [0] .L SpikeAnalyzer.cxx++
Info in <TUnixSystem::ACLiC>: creating shared library /afs/cern.ch/user/n/nvallsve/public/SpikeAnalyzer/./SpikeAnalyzer_cxx.so
/usr/bin/ld: skipping incompatible /usr/lib64/libm.so when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib64/libm.a when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib64/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib64/libc.a when searching for -lc
root [1] SpikeAnalyzer();      
I'm ready to analyze...
		=== DONE ===
root [2] .L SpikeAnalyzer.cxx++
Info in <ACLiC>: unmodified script has already been compiled and loaded
Info in <ACLiC>: it will be regenerated and reloaded!
Info in <TUnixSystem::ACLiC>: creating shared library /afs/cern.ch/user/n/nvallsve/public/SpikeAnalyzer/./SpikeAnalyzer_cxx.so
/usr/bin/ld: skipping incompatible /usr/lib64/libm.so when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib64/libm.a when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib64/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib64/libc.a when searching for -lc
root [3] SpikeAnalyzer();      
Error: Function SpikeAnalyzer() is not defined in current scope  (tmpfile):1:
*** Interpreter error recovered ***
root [4] 

– Nil

Hi Nil,

I can not reproduce the problem (even with my best guess at which version of ROOT you are using (5.22 with some patches):[code]root.exe -b


  •                                     *
    
  •    W E L C O M E  to  R O O T       *
    
  •                                     *
    
  • Version 5.22/00d 27 July 2009 *
  •                                     *
    
  • You are welcome to visit our Web site *
  •      http://root.cern.ch            *
    
  •                                     *
    

ROOT 5.22/00d (branches/v5-22-00-patches@29990, Sep 21 2009, 09:58:03 on linux)

CINT/ROOT C/C++ Interpreter version 5.16.29, Jan 08, 2008
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] .L SpikeAnalyzer.cxx++
Info in TUnixSystem::ACLiC: creating shared library /var/tmp/SpikeAnalyzer/./SpikeAnalyzer_cxx.so
root [1] SpikeAnalyzer()
I’m ready to analyze…
=== DONE ===
root [2] .L SpikeAnalyzer.cxx++
Info in : unmodified script has already been compiled and loaded
Info in : it will be regenerated and reloaded!
Info in TUnixSystem::ACLiC: creating shared library /var/tmp/SpikeAnalyzer/./SpikeAnalyzer_cxx.so
root [3] SpikeAnalyzer()
I’m ready to analyze…
=== DONE ===
root [4] .L SpikeAnalyzer.cxx++
Info in : unmodified script has already been compiled and loaded
Info in : it will be regenerated and reloaded!
Info in TUnixSystem::ACLiC: creating shared library /var/tmp/SpikeAnalyzer/./SpikeAnalyzer_cxx.so[/code].

Can you try your example with valgrind?

Philippe.

Hi Philippe,

I’ve found the cause of the problem. It was the “AutoLibraryLoader::enable();” buried deeply in my .rootlogon.C… turning it off solved it. Sorry for not thinking about this earlier.

Thanks a lot for your help,

– Nil