forked from TrueCloudLab/restic
f9501e97a2
This was a nasty bug. Users reported that restic aborts with panic: panic: store new item in finalized index The code calling panic() is in the Store() method of an index and guards the failure case that an index is to be modified while it has already been saved in the repo. What happens here (at least that's what I suspect): PackerManager calls Current() on a MasterIndex, which yields one index A. Concurrently, another goroutine calls Repository.SaveFullIndex(), which in turn calls MasterIndex.FullIndexes(), which (among others) yields the index A. Then all indexes are marked as final. Then the other goroutine is executed which adds an entry to the index A, which is now marked as final. Then the panic occurs. The commit solves this by removing MasterIndex.Current() and adding a Store() method that stores the entry in one non-finalized index. This method uses the same RWMutex as the other methods (e.g. FullIndexes()), thereby ensuring that the full indexes can only be processed before or after Store() is called. Closes #367 |
||
---|---|---|
.. | ||
cmds/restic | ||
restic |