Skip to content

Prevent hanging when opening old REST files with schema mismatches - #563

Merged
cmargalejo merged 2 commits into
masterfrom
cris_fix_old_file_hang
Jul 21, 2026
Merged

Prevent hanging when opening old REST files with schema mismatches#563
cmargalejo merged 2 commits into
masterfrom
cris_fix_old_file_hang

Conversation

@cmargalejo

@cmargalejo cmargalejo commented Apr 17, 2026

Copy link
Copy Markdown
Member

cmargalejo Ok: 22 Powered by Pull Request Badge

This PR prevents restRoot from hanging when opening files produced with older REST versions.

Context

When a REST file is produced, each class (e.g. TRestDetectorSignalToHitsProcess) is saved with a specific internal layout: which fields, in which order, how many bytes. If the class changes in a newer version, this layout no longer matches. ROOT tries to reconcile the old data with the new layout, but in some cases gets stuck, causing restRoot to hang at GetEntry(0). This fix detects those errors and skips the event loading, printing a warning instead. The analysis tree (ana_tree) and metadata remain accessible. Files produced with compatible versions are (or at least should be) unaffected.

How it works

  • ROOT provides a function called SetErrorHandler() that allows replacing the default error printing with a custom function.
  • We use this to temporarily install our own handler (SchemaErrorHandler) that does two things. It prints the error as usual, and sets a flag if the error is related to schema mismatches.
  • Before calling GetEntry(0) (the line that causes the hang), we check the flag. If schema errors were found, we skip GetEntry(0) and print a warning instead.
  • The custom handler is only active while the file is being opened. After that, ROOT's default handler is restored

Tested with two files:

@cmargalejo

Copy link
Copy Markdown
Member Author

@AlvaroEzq, @lobis, @hgmaluenda, @juanangp , small ping on this PR. We want to get a new stable REST release ready, and this is one of the PRs still waiting for review. Could you have a look when you get a chance?

@cmargalejo
cmargalejo merged commit ee5a04f into master Jul 21, 2026
64 checks passed
@cmargalejo
cmargalejo deleted the cris_fix_old_file_hang branch July 21, 2026 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants