Error in <TBufferFile::CheckByteCount>: read too few bytes

Hi,

I’ve submitted a related post today in the pyroot forum but I realize now this may be a better venue.
I’m trying to access (non-standard) objects stored in ROOT files but I receive the following error:

root [0] TFile *f = TFile::Open("file.root") root [1] WSeries<double>* a=f->Get("data") Error in <TBufferFile::CheckByteCount>: object of class WSeries<double> read too few bytes: 9363600 instead of 9365139

I write and read the file from different computers with different config.

Any suggestion to fix this error?

Thanks,
Eric
PS:

Write from the following config:

gcc (Debian 4.4.5-8) 4.4.5
root-v5-32-04.patched

Read from the following config:

gcc (Debian 4.9.1-19) 4.9.1
ROOT 5.34/19 (heads/v5-34-00-patches@v5-34-18-592-g34af149, Oct 24 2014, 14:06:00 on linuxx8664gcc)

Hi,

I thought I may provide more information about my problem.
Here is the trace I get when I attempt to read from ROOT 5.34/19.
The same code do not segfault when executed in ROOT 5-32-04.patched

Any suggestion would be very welcome!

Eric

[code]root [0] TFile file = TFile::Open(“file.root”)
root [1] WSeries
data=file->Get(“data”)
Error in TBufferFile::CheckByteCount: object of class WSeries read too few bytes: 9363600 instead of 9365139
root [2] data
(class WSeries*)0x14be6b0
root [3] data->sizeZero()
*** Break *** segmentation violation

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

#0 0x00007f8c7f29d14c in waitpid () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f8c7f22718b in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007f8c801542cf in TUnixSystem::StackTrace() () from /usr/lib/x86_64-linux-gnu/libCore.so.5.34
#3 0x00007f8c8015653c in TUnixSystem::DispatchSignals(ESignals) () from /usr/lib/x86_64-linux-gnu/libCore.so.5.34
#4
#5 0x00007f8c76194f7b in G__wave_dict_648_0_32(G__value*, char const*, G__param*, int) () from /home/ecm/Notes/13chirp_cwb/watrepo/tools/install/lib/wavelet.so
#6 0x00007f8c7e286c03 in Cint::G__ExceptionWrapper(int ()(G__value, char const*, G__param*, int), G__value*, char*, G__param*, int) () from /usr/lib/x86_64-linux-gnu/libCint.so.5.34
#7 0x00007f8c7e289074 in G__execute_call () from /usr/lib/x86_64-linux-gnu/libCint.so.5.34
#8 0x00007f8c7e28947c in G__call_cppfunc () from /usr/lib/x86_64-linux-gnu/libCint.so.5.34
#9 0x00007f8c7e25f8ad in G__interpret_func () from /usr/lib/x86_64-linux-gnu/libCint.so.5.34
#10 0x00007f8c7e22ed43 in G__getfunction () from /usr/lib/x86_64-linux-gnu/libCint.so.5.34
#11 0x00007f8c7e321941 in G__getstructmem(int, G__FastAllocString&, char*, int, char*, int*, G__var_array*, int) () from /usr/lib/x86_64-linux-gnu/libCint.so.5.34
#12 0x00007f8c7e317d4e in G__getvariable () from /usr/lib/x86_64-linux-gnu/libCint.so.5.34
#13 0x00007f8c7e33ac03 in G__getitem () from /usr/lib/x86_64-linux-gnu/libCint.so.5.34
#14 0x00007f8c7e3405f6 in G__getexpr () from /usr/lib/x86_64-linux-gnu/libCint.so.5.34
#15 0x00007f8c7e2ee5ab in G__exec_statement () from /usr/lib/x86_64-linux-gnu/libCint.so.5.34
#16 0x00007f8c7e210901 in ?? () from /usr/lib/x86_64-linux-gnu/libCint.so.5.34
#17 0x00007f8c7e211f1e in G__exec_tempfile_fp () from /usr/lib/x86_64-linux-gnu/libCint.so.5.34
#18 0x00007f8c7e2f9469 in G__process_cmd () from /usr/lib/x86_64-linux-gnu/libCint.so.5.34
#19 0x00007f8c8011b720 in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /usr/lib/x86_64-linux-gnu/libCore.so.5.34
#20 0x00007f8c800b4ce7 in TApplication::ProcessLine(char const*, bool, int*) () from /usr/lib/x86_64-linux-gnu/libCore.so.5.34
#21 0x00007f8c7fceba18 in TRint::HandleTermInput() () from /usr/lib/x86_64-linux-gnu/libRint.so.5.34
#22 0x00007f8c80155c1d in TUnixSystem::CheckDescriptors() () from /usr/lib/x86_64-linux-gnu/libCore.so.5.34
#23 0x00007f8c8015687a in TUnixSystem::DispatchOneEvent(bool) () from /usr/lib/x86_64-linux-gnu/libCore.so.5.34
#24 0x00007f8c800d1004 in TSystem::InnerLoop() () from /usr/lib/x86_64-linux-gnu/libCore.so.5.34
#25 0x00007f8c800cfc41 in TSystem::Run() () from /usr/lib/x86_64-linux-gnu/libCore.so.5.34
#26 0x00007f8c800b263f in TApplication::Run(bool) () from /usr/lib/x86_64-linux-gnu/libCore.so.5.34
#27 0x00007f8c7fcecaac in TRint::Run(bool) () from /usr/lib/x86_64-linux-gnu/libRint.so.5.34
#28 0x0000000000400ff0 in main ()

The crash is most likely caused by a problem in your script.
Try to compile it (.L myscript.C+g) and fix any errors.
If that does not help 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.[/code]

PS:

When I generate the same ROOT file (using code below), on the two platforms I’m using
I notice the files differ in size by 750 bytes.

ecm@tchao:~$ du -sb test_wdm*root
314260	test_wdm1.root (made with root-v5-32-04)
315010	test_wdm2.root (made with ROOT 5.34/19)

Is there a way to produce portable files?

Eric

test ROOT file generation:

[code]{

CWB::mdc MDC;

wavearray x = MDC.GetSGQ(1053., 9);
WDM wdm(512, 512, 4, 10);
WSeries data;
data.Forward(x, wdm);

TFile *file = new TFile(“test_wdm.root”, “CREATE”);
data.Write(“data”);
file->Close();
}
[/code]

When I try to read the file generated with ROOT 5.34/19 with ROOT 5.32/04, I get a more informative
message:

   Warning in <TStreamerInfo::BuildCheck>: 
   The StreamerInfo of class WSeries<double> read from file test_wdm2.root
   has the same version (=1) as the active class but a different checksum.
   You should update the version to ClassDef(WSeries<double>,2).
   Do not try to write objects with the current class definition,
   the files will not be readable.

Warning in <TStreamerInfo::CompareContent>: The following data member of
the on-file layout version 1 of class 'WSeries<double>' differs from 
the in-memory layout version 1:
   unsigned long w_mode; //
vs
   size_t w_mode; //

However, I checked that the WSeries object is declared with

and

on both platforms.

Any suggestions?

Eric

Hi,

[quote]Is there a way to produce portable files? [/quote]Yes. Replace the use of size_t (which is different on each platforms) by the use of ULong_t.

Cheers,
Philippe.

Thanks!

This is an improvement as I have now partial access to my object.
But that does not solve my problem entirely.

[quote]Error in TBufferFile::ReadVersion: Could not find the StreamerInfo with a checksum of 0x30000 for the class “Wavelet” in test_wdm.root.
Error in TBufferFile::ReadClassBuffer: Could not find the StreamerInfo for version 0 of the class Wavelet, object skipped at offset 262861
Error in TBufferFile::CheckByteCount: object of class WSeries read too few bytes: 262825 instead of 329122
[/quote]

Here, I don’t understand why Streamer v0 is required when I have

I attach the header files for both the WSeries and Wavelet classes.

Eric

Wavelet.hh (3.15 KB)
wseries.hh (16.8 KB)

Error in <TBufferFile::ReadVersion>: Could not find the StreamerInfo with a checksum of 0x30000 for the class "Wavelet" in test_wdm.root.humm … ReadVersion is confused on what it is reading :frowning: … I would need a standalone reproducer to investigate this.

ClassDef(Wavelet,1)Since you changed the layout a bit (size_t vs ULong_t), you should also increment the version number.

[quote]I attach the header files for both the WSeries and Wavelet classes.[/quote]From the header file, I do not see the relationship between WSeries and Wavelet ; in particular the actually datatype for which the WSeries is instantiated.

Cheers,
Philippe.

Hi Philippe

From the header file, I do not see the relationship between WSeries and Wavelet ; in particular the actual
datatype for which the WSeries is instantiated.

wseries.hh

and WaveDWT (header attached) is derived from Wavelet

In my example, I instantiate a WSeries.

ReadVersion is confused on what it is reading :frowning: … I would need a standalone reproducer to investigate this.

OK, I will try to come up with a standalone code.

Eric
WaveDWT.hh (3.88 KB)

Hi!

Here are the standalone scripts (source + binaries).
The compilation line is inserted in the source code (1st line).
They work when compiled against ROOT 5.32/04 :

[code]./test_writewdm
metadata=32
data[0]=1.15044

./test_readwdm
metadata=32
data[0]=1.15044[/code]

but not against ROOT 5.34/19 :

[code]ecm@tchao:~ ./test_writewdm metadata=32 data[0]=1.15044 ecm@tchao:~ ./test_readwdm
metadata=1

*** Break *** segmentation violation

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

#0 0x00007fd4240b414c in waitpid () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007fd42403e18b in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007fd4298ef2cf in TUnixSystem::StackTrace() () from /usr/lib/x86_64-linux-gnu/libCore.so.5.34
#3 0x00007fd4298f153c in TUnixSystem::DispatchSignals(ESignals) () from /usr/lib/x86_64-linux-gnu/libCore.so.5.34
#4
#5 0x0000000000400c10 in test_wdm() ()
#6 0x0000000000400c54 in main ()

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.

#5 0x0000000000400c10 in test_wdm() ()
#6 0x0000000000400c54 in main ()

[/code]

Thank you for your time!
Eric
binaries.tgz (7.02 KB)
test_writewdm.cc (893 Bytes)
test_readwdm.cc (692 Bytes)

1 Like