Improved error reporting for unexpected output file deletion #1270
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
Before and after execution of a script, wireit globs and stats the output files in order to remember them across runs. If some process is simultaneously writing to the same output files out-of-band, it is possible for an output file to be deleted in the small amount of time between globbing it and stat'ing it.
Before this PR, this situation was not detected, and just resulted in an unknown exception, which we log as an "Internal error".
Main change
After this PR, this situation is specifically detected, and we give a more useful error:
Other changes
When an unhandled exception occurs, we now report it with the name of the specific script that failed, instead of with the top-level entry-point script (by catching unknown exceptions on individual script executions, instead of only at the very top-level as before).
Added a test for the similar case where an input file is deleted during fingerprinting, and tweaked the error message to suggest that another process might be the cause.
Clarified the default logger vs the simple logger in the README and class names (the default changed from simple to quiet recently, but the README and class names were not quite in sync).
Document the
WIREIT_DEBUG_LOG_FILE
variable.cc @timswanson-google