Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StreamerInfo corruption or loss upon TFile update #14171

Closed
1 task done
sawenzel opened this issue Dec 4, 2023 · 5 comments
Closed
1 task done

StreamerInfo corruption or loss upon TFile update #14171

sawenzel opened this issue Dec 4, 2023 · 5 comments
Assignees
Labels
bug experiment Affects an experiment / reported by its software & computimng experts in:I/O priority:high

Comments

@sawenzel
Copy link
Contributor

sawenzel commented Dec 4, 2023

Check duplicate issues.

  • Checked for duplicates

Description

The original report is available here:
https://root-forum.cern.ch/t/streamerinfo-is-not-stored-in-tfile-with-update-mode/57383

We have an executable which loops over multiple TFiles (each containing 1 object of different classes not known to this application, though the problem is the same if all includes are added) , and for each file

opens it in the "update" mode (w/o explicitly loading the object stored in the file)
writes some simple struct with metadata
closes the file.
Afterwards, in separate processes, these files are read by other executables (Consumers) which include headers for objects inside these files.

The ClassVersion of the content for some of these files is lower than the current ClassVersion used by Consumers. Automatic schema evolution accounts for differences.

The problem appears when two initial files contain objects of the same class (MyClass in the example below) of version A while the Consumer uses higher class version B because:

the 1st updated file happens to have StreamerInfo of its original object together with the StreamerInfo of the added metadata (as shown by gFile->GetStreamerInfoList()->Print() )
the 2nd updated file has StreamerInfo only for added metadata class, reading the object from these files leads to an error.
I am wondering if there is a way to enforce the presence of the original StreamerInfo in the updated file.

The reproducer is attached:

tar xvzf tst.tar.gz ;  cd tst; chmod +x runTest.sh;
./runTest.sh
It produces (suppressing ACLIC output):

Creating library for MyClass version 1
Storing object of class version 1 in two identical files
Creating library for MyClass version 2
Updating files containing object of old class version 1 (by writing metadata object of unrelated class OtherClass)

Reading 1st (updated) file
Processing testFile.C("outv1.root")...
printing GetStreamerInfoList()->Print() for outv1.root
Collection name='TList', class='TList', size=2
 OBJ: TStreamerInfo	MyClass	
 OBJ: TStreamerInfo	OtherClass	

Reading 2nd (updated) file
Processing testFile.C("outv2.root")...
Error in <TBufferFile::CheckByteCount>: object of class MyClass read too many bytes: 12 instead of 6
Warning in <TBufferFile::CheckByteCount>: MyClass::Streamer() not in sync with data on file outv2.root, fix Streamer()
printing GetStreamerInfoList()->Print() for outv2.root
Collection name='TList', class='TList', size=1
 OBJ: TStreamerInfo	OtherClass	

Reproducer

Unzip attached file bug.zip
and run the shell scriptrunTest.sh

ROOT version

6.28/04
gcc (GCC) 12.2.0

Installation method

build from source

Operating system

MacOS, Linux

Additional context

No response

@sawenzel sawenzel added the bug label Dec 4, 2023
@sawenzel
Copy link
Contributor Author

sawenzel commented Dec 4, 2023

@bellenot bellenot added the in:I/O label Dec 4, 2023
@Axel-Naumann Axel-Naumann added experiment Affects an experiment / reported by its software & computimng experts priority:high labels Dec 4, 2023
@pcanal
Copy link
Member

pcanal commented Dec 4, 2023

As fas as I can tell the problem was solved by IO: Fix StreamerInfo record write during file update. by pcanal · Pull Request #13842 · root-project/root · GitHub which is available in v6.28/06 v6.28/08 and up.

@sawenzel
Copy link
Contributor Author

sawenzel commented Dec 5, 2023

I confirm that the issue is fixed in v6.28/08 and above. Closing the ticket.

@sawenzel sawenzel closed this as completed Dec 5, 2023
Copy link

github-actions bot commented Dec 6, 2023

Hi @sawenzel, @pcanal,

It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.

Sincerely,
🤖

1 similar comment
Copy link

github-actions bot commented Dec 7, 2023

Hi @sawenzel, @pcanal,

It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.

Sincerely,
🤖

@pcanal pcanal modified the milestones: 6.28/06, 6.30/00 Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug experiment Affects an experiment / reported by its software & computimng experts in:I/O priority:high
Projects
None yet
Development

No branches or pull requests

4 participants