Fix cleanup while cancelling during a snapshot import/export
This MR aims to fix a wrong behaviour that was observed a few times, when cancelling a snapshot export.
We now rely on the Lwt_exit clean-up callback mechanism to ensure clean-ups.
We now remove potential temporary directories left from an interrupted snapshot export.
Additionally, it removes the lock file when cancelling a snapshot import.
Fixes: #4098 (closed)
Manually testing the MR
Try to export a snapshot and cancel it (Ctrl-c) during the export. It might reproduce the behaviour at some point without the fix
for i in `seq 1 20`; do ./tezos-node snapshot export --data-dir ./snap --block head --rolling & ; sleep 2 ; kill -15 $!; done
For the import, cancel the import and look for the lock file in the data dir.
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR
Edited by Victor Allombert