[ROOT-8055] File corruption after TTree deletion Created: 15/Mar/16  Updated: 15/Mar/16  Resolved: 15/Mar/16

Status: Closed
Project: ROOT
Component/s: I/O
Affects Version/s: 6.02/08
Fix Version/s: 6.02/14, 5.34/36, 6.08/00, 6.04/16, 6.06/04

Type: Bug Priority: Critical
Reporter: Peter Onyisi Assignee: Philippe Canal
Resolution: Fixed Votes: 0
Labels: None

lxplus (SLC6), set up using ATLAS release (LCG 75root6), x86_64-slc6-gcc48-opt



As part of the ATLAS DQ monitoring we create rather large files with histograms and TTrees to keep metadata. We occasionally have files where attempting to delete one of these TTrees creates a corrupt file; an example is in /afs/cern.ch/user/p/ponyisi/public/testcase.root . The following will corrupt the file:

root [2] TFile *_file1 = TFile::Open("testcase.root", "UPDATE")
(class TFile *) 0x4485250
root [3] gDirectory->cd("/run_284285/lowStat_LB1001-1020/HLT/MuonMon/Coverage")
(Bool_t) true
root [4] gDirectory->Delete("metadata;1")
root [5] _file1->Write()
(Int_t) 0
root [6] .q

as evidenced by

root -l testcase.root
root [0] 
Attaching file testcase.root as _file0...
(class TFile *) 0x1d8dc10
root [1] gDirectory->cd("/run_284285/lowStat_LB1001-1020/HLT/MuonMon/Coverage")
SysError in <TFile::Seek>: cannot seek to position -1807292313 in file testcase.root, retpos=-1 (Invalid argument)
Error in <TDirectoryFile::ReadKeys>: reading illegal key, exiting after 0 keys
Error in <TDirectoryFile::cd>: Unknown directory MuonMon
(Bool_t) false

Are we doing something wrong? This is a real worry for our DQ operations.

Comment by Peter Onyisi [ 15/Mar/16 ]

As an additional data point, the same issue occurs in 5.34/25.

Comment by Philippe Canal [ 15/Mar/16 ]


The was indeed an issue when space is freed in a large `ROOT` file and a TDirectory is updated and stored the lower (less than 2GB) freed portion of the file. There is no trivial way to recover the file after this issue.

The problem has been solved in the master and in the v6.06, v6.04, v6.02, v5.34 patch branches.
See commit 5856ab247558cb423435c7bdc7aa5c9dd3a3335e.


Generated at Mon Feb 24 17:05:54 CET 2020 using Jira 8.3.4#803005-sha1:1f96e09b3c60279a408a2ae47be3c745f571388b.