Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app/eth2wrap: fix cancelled context race #1378

Merged
merged 1 commit into from
Nov 2, 2022

Conversation

corverroos
Copy link
Contributor

Fixes a race in eth2wrap forkjoin code when context is cancelled before any results are returned. This resulted in <zero>,nil being returned which resulted in unexpected behaviour, including "divide by zero".

category: bug
ticket: #1326

zero O
nokResp forkjoin.Result[Client, O]
hasNokResp bool
zero O
)
for res := range join() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when the calling context is already/immediately closed, then forkjoin doesn't return any results.

}
}

if ctx.Err() != nil {
return zero, ctx.Err()
} else if !hasNokResp {
Copy link
Contributor Author

@corverroos corverroos Nov 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just a sanity check and should never happen

@codecov
Copy link

codecov bot commented Nov 2, 2022

Codecov Report

Base: 54.19% // Head: 54.26% // Increases project coverage by +0.07% 🎉

Coverage data is based on head (95b4696) compared to base (f5935e9).
Patch coverage: 66.66% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1378      +/-   ##
==========================================
+ Coverage   54.19%   54.26%   +0.07%     
==========================================
  Files         144      144              
  Lines       17750    17757       +7     
==========================================
+ Hits         9619     9636      +17     
+ Misses       6809     6796      -13     
- Partials     1322     1325       +3     
Impacted Files Coverage Δ
app/eth2wrap/eth2wrap.go 61.71% <66.66%> (-0.27%) ⬇️
app/app.go 60.21% <0.00%> (-0.87%) ⬇️
core/qbft/qbft.go 81.54% <0.00%> (-0.43%) ⬇️
app/vmock.go 73.79% <0.00%> (+1.06%) ⬆️
app/eth2wrap/eth2wrap_gen.go 12.73% <0.00%> (+2.08%) ⬆️
core/priority/prioritiser.go 68.91% <0.00%> (+4.14%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@corverroos corverroos linked an issue Nov 2, 2022 that may be closed by this pull request
@corverroos corverroos added the merge when ready Indicates bulldozer bot may merge when all checks pass label Nov 2, 2022
@obol-bulldozer obol-bulldozer bot merged commit a025b4d into main Nov 2, 2022
@obol-bulldozer obol-bulldozer bot deleted the corver/fixctxcancelled branch November 2, 2022 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge when ready Indicates bulldozer bot may merge when all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

eth2wrap returns zero slot duration sporadically on shutdown.
2 participants