What version are you using?
latest
Problem
File: internal/services/ingest_backfill.go lines 402-414
Buggy code:
func (m *ingestService) setupBatchBackend(ctx context.Context, batch BackfillBatch) (ledgerbackend.LedgerBackend, error) {
backend, err := m.ledgerBackendFactory(ctx)
if err != nil {
return nil, fmt.Errorf("creating ledger backend: %w", err)
}
ledgerRange := ledgerbackend.BoundedRange(batch.StartLedger, batch.EndLedger)
if err := backend.PrepareRange(ctx, ledgerRange); err != nil {
// BUG: backend is never closed here
return nil, fmt.Errorf("preparing backend range: %w", err)
}
return backend, nil
}
Description: When PrepareRange fails, the function returns nil for the backend, so the caller's defer backend.Close() cannot clean it up. Each leaked backend holds network connections and potentially streaming goroutines. During parallel backfill with many batches, repeated PrepareRange failures can exhaust file descriptors or memory.
Suggested fix:
if err := backend.PrepareRange(ctx, ledgerRange); err != nil {
_ = backend.Close()
return nil, fmt.Errorf("preparing backend range: %w", err)
}
What version are you using?
latest
Problem
File:
internal/services/ingest_backfill.golines 402-414Buggy code:
Description: When
PrepareRangefails, the function returnsnilfor the backend, so the caller'sdefer backend.Close()cannot clean it up. Each leaked backend holds network connections and potentially streaming goroutines. During parallel backfill with many batches, repeated PrepareRange failures can exhaust file descriptors or memory.Suggested fix: