diff --git a/extern/storage-sealing/fsm.go b/extern/storage-sealing/fsm.go index 09ac8c61b..ea4982d2c 100644 --- a/extern/storage-sealing/fsm.go +++ b/extern/storage-sealing/fsm.go @@ -409,8 +409,9 @@ func (m *Sealing) restartSectors(ctx context.Context) error { return err } - m.unsealedInfoMap.lk.Lock() + // m.unsealedInfoMap.lk.Lock() taken early in .New to prevent races defer m.unsealedInfoMap.lk.Unlock() + for _, sector := range trackedSectors { if err := m.sectors.Send(uint64(sector.SectorNumber), SectorRestart{}); err != nil { log.Errorf("restarting sector %d: %+v", sector.SectorNumber, err) diff --git a/extern/storage-sealing/sealing.go b/extern/storage-sealing/sealing.go index d0c8fd3c9..92beb8ddf 100644 --- a/extern/storage-sealing/sealing.go +++ b/extern/storage-sealing/sealing.go @@ -145,6 +145,8 @@ func New(api SealingAPI, fc FeeConfig, events Events, maddr address.Address, ds s.sectors = statemachine.New(namespace.Wrap(ds, datastore.NewKey(SectorStorePrefix)), s, SectorInfo{}) + s.unsealedInfoMap.lk.Lock() // released after initialized in .Run() + return s }