Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions operator/pkg/operator.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,7 @@ import (
"encoding/hex"
"fmt"
"log"
"runtime"
"sync"
"time"

Expand DownExpand Up@@ -241,8 +242,16 @@ func (o *Operator) ProcessNewBatchLogV2(newBatchLog *servicemanager.ContractAlig
wg.Add(verificationDataBatchLen)
for _, verificationData := range verificationDataBatch {
go func(data VerificationData) {
defer wg.Done()
defer func() {
if r := recover(); r != nil {
// Most common panic we experience is runtime OOM, so GC to keep going
runtime.GC()
o.Logger.Errorf("Verification goroutine panicked", "msg", r, "verification_data", verificationData)
}
wg.Done()
}()
o.verify(data, results)
//FIXME: include in the defer with failure metric
o.metrics.IncOperatorTaskResponses()
}(verificationData)
}
Expand DownExpand Up@@ -312,7 +321,14 @@ func (o *Operator) ProcessNewBatchLogV3(newBatchLog *servicemanager.ContractAlig
wg.Add(verificationDataBatchLen)
for _, verificationData := range verificationDataBatch {
go func(data VerificationData) {
defer wg.Done()
defer func() {
if r := recover(); r != nil {
// Most common panic we experience is runtime OOM, so GC to keep going
runtime.GC()
o.Logger.Errorf("Verification goroutine panicked", "msg", r, "verification_data", verificationData)
}
wg.Done()
}()
o.verify(data, results)
o.metrics.IncOperatorTaskResponses()
}(verificationData)
Expand Down