The MFS root state isn't saved if the daemon is stopped with Ctrl+C
#5868
Labels
kind/bug
A bug in existing code (including security flaws)
topic/commands
Topic commands
topic/MFS
Topic MFS
Following a series of (maybe not bugs but at least) some unusual behaviors I've found that
Ctrl+C
ing the daemon causes the MFS root'sClose
method (inteardown
) to silently fail and thus causing any un-flushed files to be lost. Since theipfs files
command has the--flush
option set by default this may not have had serious repercussions.The
Close
error was (silently) failing because, when flushing, theDAG.Add
operation was failing withblockservice is closed
that was actually a hard-coded error (which threw me off substantially) shadowing any generalHasBlock
errors in the exchange service, i.e., Bitswap.The real error was
bitswap is closed
generated inreceiveBlockFrom
that detected that theprocess
was on its way to shutting down. Thisprocess
was tied to the context that created the Bitswap interface, which actually seems to be derived from the original context that started the daemon that is closed when signaling the interrupt generated byCtrl+C
,https://github.com/ipfs/go-ipfs/blob/c17aaa6e26512b6bbd0f60c0c39c82daacfba9e1/cmd/ipfs/main.go#L396-L409
This doesn't seem to happen with the
ipfs shutdown
command which more gracefully issues aProcess().Close()
without canceling the root context.The text was updated successfully, but these errors were encountered: