Segmentation fault on ReadObjectAny()


I’m working on development a analysis framework. I want parallel processing of ROOT data not only in SMP but also network clusters and GRID.
I use TMessage for that and succeed to make them entry by entry from ROOT file.

But in opposite side, there’s a problem.

When I make event from TMessage by using ReadObjectAny function, the segmentation fault occurs as below.

Fatal in <TMessage::>: IsReading() violated at line 2170 of `base/src/TBuffer.cxx' aborting Using host libthread_db library "/lib/tls/". Attaching to program: /proc/15903/exe, process 15903 [Thread debugging using libthread_db enabled] [New Thread -1218606528 (LWP 15903)] 0x057a551e in __waitpid_nocancel () from /lib/tls/ Thread 1 (Thread -1218606528 (LWP 15903)): #0 0x057a551e in __waitpid_nocancel () from /lib/tls/ #1 0x0573a1d4 in do_system () from /lib/tls/ #2 0x00f55d7f in system () from /lib/tls/ #3 0x009406f9 in TUnixSystem::Exec () from /root/lib/ #4 0x00940b29 in TUnixSystem::StackTrace () from /root/lib/ #5 0x0080ca38 in DefaultErrorHandler () from /root/lib/ #6 0x0080cc0e in ErrorHandler () from/root/lib/ #7 0x0083b7ff in TObject::DoError () from /root/lib/ #8 0x0083b939 in TObject::Fatal () from /root/lib/ #9 0x007fd278 in TBuffer::ReadObjectAny () from /root/lib/ #10 0x0805031e in OutputServer::msg_decoder (this=0x8f89120, msg=0x915ccf0) at #11 0x0804e441 in main (argc=2, argv=0xbfff9124) at Abort

And here’s my code which makes the error.

103 MyEvent* OutputServer::msg_decoder(TMessage* msg) { 104 msg->Uncompress(); 105 106 MyEvent* event = (MyEvent*)msg->ReadObjectAny(MyEvent::Class()); 108 109 return event; 110 }

Am I wrong for using the ReadObjectAny function?


Somehow your TMessage object is set in write mode. Call msg->SetReadMode() to force it into read mode (but you should also understand why it was in write mode).


Hi Philippe,

It seems to work, thanks!