NebulousLabs / Sia

Blockchain-based marketplace for file storage. Project has moved to GitLab: https://gitlab.com/NebulousLabs/Sia
https://sia.tech
MIT License
2.71k stars 442 forks source link

Contractor persistence corrupted when disk is full #3153

Closed MSevey closed 5 years ago

MSevey commented 5 years ago

The contractor persistence is not written atomically as there is an edge case of when the disk is full both contractor.json and contractor.json_temp stop writing mid file causing an error on start up.

unable to read persisted json object from disk: invalid character '{' after top-level value

The files have to be deleted which then cause a secondary error of: panic: renewed should never miss an id

Which is cause by the renter still being persisted, so when threadedUploadLoop starts checking files and hosts, it can't find the hosts associated with the files because that information was stored in the contractor persistence.