You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A blob drop that dies after its unlink lets a concurrent fork record an image over the missing file #212
Found by model checking (the Quint specs in #206). A counterexample in the model, each step read in the code at e281a48. Not reproduced on a running system.
Where:lib/hyper/img.ex:179-207: drop_blob/1 removes the file, then the row, inside one transaction. img.ex:259-304: record_derived/3. img.ex:414-420: backed/2, which it runs for the new delta blob only.
Chain:
create_derived/4 over parent image P reads P's chain.
delete/1 of P commits forget/1. drop_blob/1 then locks base blob B, finds no layer referencing it, and unlinks its file.
That transaction dies before its commit (connection lost, node killed). Row B stays with no file. The comment at img.ex:183-184 leaves such a row to the GC.
The derive inserts its layer rows. The one referencing B passes its foreign key because the row exists, and nothing checks B's file.
Effect: a derived image recorded over a base blob that is gone. The GC keeps and reports it as a dangling reference and cannot repair it.
Model:image_store_failed_drop violates layersHaveFiles. image_store_fork_vs_delete, the same race with no failing drop, holds. The trace, from spec/ on that branch after npm ci:
Repro: not written. With real connections: start create_derived/4 over a parent, delete the parent image, and kill the connection of the drop_blob/1 transaction after its File.rm (or make the row delete fail). Let the derive finish and check the base file.
Fix: run backed/2 over every blob of the chain in record_derived/3, not only the delta.
Activity