mirror of
https://github.com/octoleo/restic.git
synced 2024-11-26 23:06:32 +00:00
bdf7ba20cb
The Save methods of the BlobSaver, FileSaver and TreeSaver return early on when the archiver is stopped due to an error. For that they select on both the tomb.Dying() and context.Done() channels, which can lead to a race condition when the tomb is killed due to an error: The tomb first closes its Dying channel before canceling all child contexts. Archiver.SaveDir only aborts its execution once the context was canceled. When the tomb killing is paused between closing its Dying channel and canceling the child contexts, this lets the FileSaver/TreeSaver.Save methods return immediately, however, ScanDir still reads further files causing the test case to fail. As a killed tomb always cancels all child contexts and as the Savers always use a context bound to the tomb, it is sufficient to just use context.Done() as escape hatch in the Save functions. This fixes the mismatch between SaveDir and Save. Adjust the tests to use contexts bound to the tomb for all interactions with the Savers. |
||
---|---|---|
.. | ||
archiver | ||
backend | ||
cache | ||
checker | ||
crypto | ||
debug | ||
errors | ||
filter | ||
fs | ||
fuse | ||
hashing | ||
index | ||
limiter | ||
migrations | ||
mock | ||
options | ||
pack | ||
repository | ||
restic | ||
restorer | ||
selfupdate | ||
test | ||
textfile | ||
ui | ||
walker |