Proof crash when compiled

Why this simple code crash at the end:

#include <TProof.h>

int main()
{
  TProof *p = TProof::Open("localhost");
  return 0;
}

 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================

Thread 3 (Thread 0x427ad940 (LWP 15789)):
#0  0x000000326e69a3f1 in nanosleep () from /lib64/libc.so.6
#1  0x000000326e69a214 in sleep () from /lib64/libc.so.6
#2  0x00002ad603510893 in GarbageCollectorThread (arg=0x1b1e0dd0, 
    thr=<value optimized out>) at XrdClientConnMgr.cc:73
#3  0x00002ad6032b4f41 in XrdSysThread_Xeq ()
   from /gpfs/storage_4/users/home/proof/root/lib/libProofx.so
#4  0x000000326ee0673d in start_thread () from /lib64/libpthread.so.0
#5  0x000000326e6d3f6d in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x41a61940 (LWP 15790)):
#0  0x000000326e6cb186 in poll () from /lib64/libc.so.6
#1  0x00002ad6034f6a26 in XrdClientSock::RecvRaw (this=0x1b1e6280, 
    buffer=0x1b27bfa0, length=8, substreamid=-1, usedsubstreamid=0x1)
    at XrdClientSock.cc:128
#2  0x00002ad60351924a in XrdClientPhyConnection::ReadRaw (this=0x1b1e4aa0, 
    buf=0x1b27bfa0, len=8, substreamid=-1, usedsubstreamid=0x41a6092c)
    at XrdClientPhyConnection.cc:362
#3  0x00002ad603515363 in XrdClientMessage::ReadRaw (this=0x1b27bf60, 
    phy=0x1b1e4aa0) at XrdClientMessage.cc:152
#4  0x00002ad60351855f in XrdClientPhyConnection::BuildMessage (
    this=0x1b1e4aa0, IgnoreTimeouts=true, Enqueue=true)
    at XrdClientPhyConnection.cc:443
#5  0x00002ad60351d376 in SocketReaderThread (arg=0x1b1e4aa0, 
    thr=<value optimized out>) at XrdClientPhyConnection.cc:61
#6  0x00002ad6032b4f41 in XrdSysThread_Xeq ()
   from /gpfs/storage_4/users/home/proof/root/lib/libProofx.so
#7  0x000000326ee0673d in start_thread () from /lib64/libpthread.so.0
#8  0x000000326e6d3f6d in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x2ad602ae4a10 (LWP 15788)):
#0  0x000000326e699fff in waitpid () from /lib64/libc.so.6
#1  0x000000326e63c331 in do_system () from /lib64/libc.so.6
#2  0x000000326e63c687 in system () from /lib64/libc.so.6
#3  0x00002ad5fe6aaf70 in TUnixSystem::StackTrace ()
   from /gpfs/storage_4/users/home/proof/root/lib/libCore.so
#4  0x00002ad5fe6a766b in TUnixSystem::DispatchSignals ()
   from /gpfs/storage_4/users/home/proof/root/lib/libCore.so
#5  <signal handler called>
#6  0x00000032708e97f0 in vtable for __cxxabiv1::__class_type_info ()
   from /usr/lib64/libstdc++.so.6
#7  0x00002ad60328d2b7 in TXSockPipe::Flush ()
   from /gpfs/storage_4/users/home/proof/root/lib/libProofx.so
#8  0x00002ad60328d465 in TXSocket::Close ()
   from /gpfs/storage_4/users/home/proof/root/lib/libProofx.so
#9  0x00002ad6032866af in TXSlave::Close ()
   from /gpfs/storage_4/users/home/proof/root/lib/libProofx.so
#10 0x00002ad602570472 in TProof::Close ()
   from /gpfs/storage_4/users/home/proof/root/lib/libProof.so
#11 0x00002ad60259434a in TProof::~TProof ()
   from /gpfs/storage_4/users/home/proof/root/lib/libProof.so
#12 0x00002ad5fe64dd3d in TCollection::GarbageCollect ()
   from /gpfs/storage_4/users/home/proof/root/lib/libCore.so
#13 0x00002ad5fe6524e5 in TList::Delete ()
   from /gpfs/storage_4/users/home/proof/root/lib/libCore.so
#14 0x00002ad5fe605904 in TROOT::~TROOT ()
   from /gpfs/storage_4/users/home/proof/root/lib/libCore.so
#15 0x000000326e63368e in __cxa_finalize () from /lib64/libc.so.6
#16 0x00002ad5fe5ba3b6 in __do_global_dtors_aux ()
   from /gpfs/storage_4/users/home/proof/root/lib/libCore.so
#17 0x0000000000000000 in ?? ()
===========================================================


The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#6  0x00000032708e97f0 in vtable for __cxxabiv1::__class_type_info ()
   from /usr/lib64/libstdc++.so.6
#7  0x00002ad60328d2b7 in TXSockPipe::Flush ()
   from /gpfs/storage_4/users/home/proof/root/lib/libProofx.so
#8  0x00002ad60328d465 in TXSocket::Close ()
   from /gpfs/storage_4/users/home/proof/root/lib/libProofx.so
#9  0x00002ad6032866af in TXSlave::Close ()
   from /gpfs/storage_4/users/home/proof/root/lib/libProofx.so
#10 0x00002ad602570472 in TProof::Close ()
   from /gpfs/storage_4/users/home/proof/root/lib/libProof.so
#11 0x00002ad60259434a in TProof::~TProof ()
   from /gpfs/storage_4/users/home/proof/root/lib/libProof.so
#12 0x00002ad5fe64dd3d in TCollection::GarbageCollect ()
   from /gpfs/storage_4/users/home/proof/root/lib/libCore.so
#13 0x00002ad5fe6524e5 in TList::Delete ()
   from /gpfs/storage_4/users/home/proof/root/lib/libCore.so
#14 0x00002ad5fe605904 in TROOT::~TROOT ()
   from /gpfs/storage_4/users/home/proof/root/lib/libCore.so
#15 0x000000326e63368e in __cxa_finalize () from /lib64/libc.so.6
#16 0x00002ad5fe5ba3b6 in __do_global_dtors_aux ()
   from /gpfs/storage_4/users/home/proof/root/lib/libCore.so
#17 0x0000000000000000 in ?? ()
===========================================================

If I add a p->Process(…) it works, it processes and write the output, but I get the same crash just at the end.

Hi,

In ROOT standalone applications either you explicitly clean what you created, e.g.

p->Close("S");
delete p;

or you must call the following

gSystem->Exit(0);

for proper cleaning of created objects.
Could you try that?

G. Ganis

[quote=“ganis”]Hi,

In ROOT standalone applications either you explicitly clean what you created, e.g.

p->Close("S");
delete p;

or you must call the following

gSystem->Exit(0);

for proper cleaning of created objects.
Could you try that?

G. Ganis[/quote]

the second solution works, the first not.

Well, because probably there are other internal things to be cleaned.
The second is definitely the advised solution.