Segmentation fault on ReadObjectAny()

Hi,

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/libthread_db.so.1". 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/libc.so.6 Thread 1 (Thread -1218606528 (LWP 15903)): #0 0x057a551e in __waitpid_nocancel () from /lib/tls/libc.so.6 #1 0x0573a1d4 in do_system () from /lib/tls/libc.so.6 #2 0x00f55d7f in system () from /lib/tls/libpthread.so.0 #3 0x009406f9 in TUnixSystem::Exec () from /root/lib/libCore.so #4 0x00940b29 in TUnixSystem::StackTrace () from /root/lib/libCore.so #5 0x0080ca38 in DefaultErrorHandler () from /root/lib/libCore.so #6 0x0080cc0e in ErrorHandler () from/root/lib/libCore.so #7 0x0083b7ff in TObject::DoError () from /root/lib/libCore.so #8 0x0083b939 in TObject::Fatal () from /root/lib/libCore.so #9 0x007fd278 in TBuffer::ReadObjectAny () from /root/lib/libCore.so #10 0x0805031e in OutputServer::msg_decoder (this=0x8f89120, msg=0x915ccf0) at outputsrv.cc:106 #11 0x0804e441 in main (argc=2, argv=0xbfff9124) at main.cc:96 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?

Hi,

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).

Cheers,
Philippe.

Hi Philippe,

It seems to work, thanks!