Skip to content

fix AddSectorBatch on large contracts

Boris Nagaev requested to merge starius:mitigate-renew-failure into master

AddSectorBatch is applied to the whole list of sectors of a contract being renewed. The function started a goroutine per sector before. Each goroutine made disk access to update the sector's reference counter. This resulted is thousands of goroutines and potentially OS threads. The tool crashed when a large contract was renewed: https://github.com/NebulousLabs/Sia/issues/1775#issuecomment-330666550

This commit sets a cap for maximum parallel running goroutines in that group.

This PR is the mitigation to stop bleeding. Another PR which is more long term and will take more time is https://github.com/NebulousLabs/Sia/pull/2361

Merge request reports