Closed ChrisSchinnerl closed 2 years ago
I upgrade skyd's dependency of siad to 1.5.8 today and during one of the CI runs the race detector got triggered. Some race in the host code.
I'm a bit swamped atm so I haven't looked into it yet but hopefully it's an easy fix.
================== WARNING: DATA RACE Read at 0x00c0014b6150 by goroutine 646: go.sia.tech/siad/modules/host/contractmanager.(*ContractManager).StorageFolders() /builds/SkynetLabs/skyd/.cache/pkg/mod/go.sia.tech/siad@v1.5.8/modules/host/contractmanager/storagefolder.go:454 +0x40a go.sia.tech/siad/modules/host.(*Host).capacity() /builds/SkynetLabs/skyd/.cache/pkg/mod/go.sia.tech/siad@v1.5.8/modules/host/negotiatesettings.go:19 +0x81 go.sia.tech/siad/modules/host.(*Host).externalSettings() /builds/SkynetLabs/skyd/.cache/pkg/mod/go.sia.tech/siad@v1.5.8/modules/host/negotiatesettings.go:32 +0xe4 go.sia.tech/siad/modules/host.(*Host).managedUpdatePriceTable() /builds/SkynetLabs/skyd/.cache/pkg/mod/go.sia.tech/siad@v1.5.8/modules/host/host.go:334 +0x15d go.sia.tech/siad/modules/host.(*Host).managedPriceTableForRenter() /builds/SkynetLabs/skyd/.cache/pkg/mod/go.sia.tech/siad@v1.5.8/modules/host/rpcupdatepricetable.go:96 +0x55 go.sia.tech/siad/modules/host.(*Host).managedRPCUpdatePriceTable() /builds/SkynetLabs/skyd/.cache/pkg/mod/go.sia.tech/siad@v1.5.8/modules/host/rpcupdatepricetable.go:115 +0x64 go.sia.tech/siad/modules/host.(*Host).threadedHandleStream() /builds/SkynetLabs/skyd/.cache/pkg/mod/go.sia.tech/siad@v1.5.8/modules/host/network.go:415 +0xd2e go.sia.tech/siad/modules/host.(*Host).threadedHandleStream-fm() /builds/SkynetLabs/skyd/.cache/pkg/mod/go.sia.tech/siad@v1.5.8/modules/host/network.go:349 +0x55 gitlab.com/NebulousLabs/siamux.(*Handler).threadedHandleNext() /builds/SkynetLabs/skyd/.cache/pkg/mod/gitlab.com/!nebulous!labs/siamux@v0.0.0-[202](https://gitlab.com/SkynetLabs/skyd/-/jobs/2538217416#L202)20503124529-186b4b9c9aff/listener.go:82 +0x24f gitlab.com/NebulousLabs/siamux.(*SiaMux).threadedAccept.func2() /builds/SkynetLabs/skyd/.cache/pkg/mod/gitlab.com/!nebulous!labs/siamux@v0.0.0-20220503124529-186b4b9c9aff/listener.go:280 +0x76 Previous write at 0x00c0014b6150 by goroutine [203](https://gitlab.com/SkynetLabs/skyd/-/jobs/2538217416#L203): go.sia.tech/siad/modules/host/contractmanager.(*storageFolder).setUsage() /builds/SkynetLabs/skyd/.cache/pkg/mod/go.sia.tech/siad@v1.5.8/modules/host/contractmanager/storagefolder.go:277 +0x12de go.sia.tech/siad/modules/host/contractmanager.(*writeAheadLog).managedAddPhysicalSector.func1() /builds/SkynetLabs/skyd/.cache/pkg/mod/go.sia.tech/siad@v1.5.8/modules/host/contractmanager/sectorupdate.go:89 +0x19a go.sia.tech/siad/modules/host/contractmanager.(*writeAheadLog).managedAddPhysicalSector() /builds/SkynetLabs/skyd/.cache/pkg/mod/go.sia.tech/siad@v1.5.8/modules/host/contractmanager/sectorupdate.go:144 +0x21a go.sia.tech/siad/modules/host/contractmanager.(*ContractManager).AddSector() /builds/SkynetLabs/skyd/.cache/pkg/mod/go.sia.tech/siad@v1.5.8/modules/host/contractmanager/sectorupdate.go:563 +0x7a5 go.sia.tech/siad/modules/host.(*Host).managedModifyStorageObligation() /builds/SkynetLabs/skyd/.cache/pkg/mod/go.sia.tech/siad@v1.5.8/modules/host/storageobligations.go:889 +0x8bc go.sia.tech/siad/modules/host.(*Host).managedRPCLoopWrite() /builds/SkynetLabs/skyd/.cache/pkg/mod/go.sia.tech/siad@v1.5.8/modules/host/newrpc.go:389 +0x2537 go.sia.tech/siad/modules/host.(*Host).managedRPCLoopWrite-fm() /builds/SkynetLabs/skyd/.cache/pkg/mod/go.sia.tech/siad@v1.5.8/modules/host/newrpc.go:162 +0x4b go.sia.tech/siad/modules/host.(*Host).managedRPCLoop() /builds/SkynetLabs/skyd/.cache/pkg/mod/go.sia.tech/siad@v1.5.8/modules/host/rpcloop.go:145 +0x1698 go.sia.tech/siad/modules/host.(*Host).threadedHandleConn() /builds/SkynetLabs/skyd/.cache/pkg/mod/go.sia.tech/siad@v1.5.8/modules/host/network.go:321 +0x93d Goroutine 646 (running) created at: gitlab.com/NebulousLabs/siamux.(*SiaMux).threadedAccept() /builds/SkynetLabs/skyd/.cache/pkg/mod/gitlab.com/!nebulous!labs/siamux@v0.0.0-202[205](https://gitlab.com/SkynetLabs/skyd/-/jobs/2538217416#L205)03124529-186b4b9c9aff/listener.go:278 +0x86f gitlab.com/NebulousLabs/siamux.(*SiaMux).managedUpgradeConn.func3() /builds/SkynetLabs/skyd/.cache/pkg/mod/gitlab.com/!nebulous!labs/siamux@v0.0.0-20[220](https://gitlab.com/SkynetLabs/skyd/-/jobs/2538217416#L220)503124529-186b4b9c9aff/siamux.go:625 +0x44 Goroutine 203 (running) created at: go.sia.tech/siad/modules/host.(*Host).threadedListen() /builds/SkynetLabs/skyd/.cache/pkg/mod/go.sia.tech/siad@v1.5.8/modules/host/network.go:452 +0x1c5 ================== FAIL gitlab.com/SkynetLabs/skyd/siatest/renter [229](https://gitlab.com/SkynetLabs/skyd/-/jobs/2538217416#L229).305s FAIL
I upgrade skyd's dependency of siad to 1.5.8 today and during one of the CI runs the race detector got triggered. Some race in the host code.
I'm a bit swamped atm so I haven't looked into it yet but hopefully it's an easy fix.