Open
Description
Check duplicate issues.
- Checked for duplicates
Description
When deleting several large, consecutive objects (or many small ones), TFile crashes or corrupts the file. The problem seems to be oversized gaps due to coalescing. If the gap becomes larger than 2GB, ROOT crashes. A gap between 1GB and 2GB is successfully created but an attempt to store a small object in this gap corrupts the file.
Reproducer
#include <vector>
class Large {
public:
std::vector<char> fVec;
};
auto f = TFile::Open("large.root", "RECREATE");
f->SetCompressionSettings(0);
auto obj = new Large();
obj->fVec.resize(1024*1024*1024 - 100, 'x'); // almost 1 GB
f->WriteObject(obj, "obj1");
f->WriteObject(obj, "obj2");
obj->fVec.resize(1024*1024, 'x');
f->WriteObject(obj, "obj3");
f->Write();
f->Close();
delete f;
f = TFile::Open("large.root", "UPDATE");
f->Delete("obj1;*");
// If the next two lines are uncommented, ROOT crashes
//f->Delete("obj2;*");
//f->Delete("obj3;*");
// Creates a combined gap close to 2GB
f->Delete("obj2;*");
f->Write();
f->Close();
delete f;
f = TFile::Open("large.root", "UPDATE");
f->WriteObject(obj, "obj4"); // corrupts the file
f->Write();
f->Close();
delete f;
f = TFile::Open("large.root");
f->Map("extended");
ROOT version
master
Installation method
From source
Operating system
Linux
Additional context
No response