storage: Log a detailed error on PoSt challenge read timeout

This commit is contained in:
Łukasz Magiera 2022-11-09 12:49:52 +01:00
parent 42d02dd448
commit cbcd0d49ae

View File

@ -759,20 +759,22 @@ func (st *Local) GenerateSingleVanillaProof(ctx context.Context, minerID abi.Act
ProofType: si.SealProof,
}
var cache string
var sealed string
var cache, sealed, cacheID, sealedID string
if si.Update {
src, _, err := st.AcquireSector(ctx, sr, storiface.FTUpdate|storiface.FTUpdateCache, storiface.FTNone, storiface.PathStorage, storiface.AcquireMove)
src, si, err := st.AcquireSector(ctx, sr, storiface.FTUpdate|storiface.FTUpdateCache, storiface.FTNone, storiface.PathStorage, storiface.AcquireMove)
if err != nil {
return nil, xerrors.Errorf("acquire sector: %w", err)
}
cache, sealed = src.UpdateCache, src.Update
cacheID, sealedID = si.UpdateCache, si.Update
} else {
src, _, err := st.AcquireSector(ctx, sr, storiface.FTSealed|storiface.FTCache, storiface.FTNone, storiface.PathStorage, storiface.AcquireMove)
src, si, err := st.AcquireSector(ctx, sr, storiface.FTSealed|storiface.FTCache, storiface.FTNone, storiface.PathStorage, storiface.AcquireMove)
if err != nil {
return nil, xerrors.Errorf("acquire sector: %w", err)
}
cache, sealed = src.Cache, src.Sealed
cacheID, sealedID = si.Cache, si.Sealed
}
if sealed == "" || cache == "" {
@ -790,6 +792,8 @@ func (st *Local) GenerateSingleVanillaProof(ctx context.Context, minerID abi.Act
SealedSectorPath: sealed,
}
start := time.Now()
resCh := make(chan result.Result[[]byte], 1)
go func() {
resCh <- result.Wrap(ffi.GenerateSingleVanillaProof(psi, si.Challenge))
@ -799,6 +803,8 @@ func (st *Local) GenerateSingleVanillaProof(ctx context.Context, minerID abi.Act
case r := <-resCh:
return r.Unwrap()
case <-ctx.Done():
log.Errorw("failed to generate valilla PoSt proof before context cancellation", "err", ctx.Err(), "duration", time.Now().Sub(start), "cache-id", cacheID, "sealed-id", sealedID, "cache", cache, "sealed", sealed)
// this will leave the GenerateSingleVanillaProof goroutine hanging, but that's still less bad than failing PoSt
return nil, xerrors.Errorf("failed to generate valilla proof before context cancellation: %w", ctx.Err())
}