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

Do not retry after a rejected message #1278

Merged
merged 2 commits into from
Apr 21, 2023
Merged

Conversation

awrichar
Copy link
Contributor

Fixes regression from #1251

@codecov-commenter
Copy link

codecov-commenter commented Apr 18, 2023

Codecov Report

Merging #1278 (29eaf9f) into main (f892be6) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main     #1278   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          308       308           
  Lines        20720     20723    +3     
=========================================
+ Hits         20720     20723    +3     
Impacted Files Coverage Δ
internal/events/aggregator.go 100.00% <100.00%> (ø)

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

@@ -535,8 +535,7 @@ func (ag *aggregator) processMessage(ctx context.Context, manifest *core.BatchMa
np.IncrementNextPin(ctx, ag.namespace)
}
state.markMessageDispatched(manifest.ID, msg, msgBaseIndex, newState)

return err
return nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a smell that we're not checking the err = ag.checkOnchainConsistency error above?
Or else, what path was it that dropped an error down to here that we did not want to return?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The contract of this method is that it should only return retryable errors, which should happen on line 522. No new errors can happen between that line and here.

Rejection sometimes returns a reason in the error field, which is generally just logged but shouldn't trigger retry.

We probably could spend another few days cleaning up all these paths though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the specific path that might return reject with err is via ag.definitions.HandleDefinitionBroadcast.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added another commit to log and drop the error along that specific path, which also likely solves the issues I was seeing. But I think it still feels pretty correct to return nil here, at least as the code stands right now. Figuring out how to spell retryable vs. non-retryable errors throughout this whole package has been challenging.

@@ -607,6 +606,10 @@ func (ag *aggregator) readyForDispatch(ctx context.Context, msg *core.Message, d
var handlerResult definitions.HandlerResult
handlerResult, err = ag.definitions.HandleDefinitionBroadcast(ctx, &state.BatchState, msg, data, tx)
log.L(ctx).Infof("Result of definition broadcast '%s' [%s]: %s", msg.Header.Tag, msg.Header.ID, handlerResult.Action)
if handlerResult.Action == core.ActionReject {
log.L(ctx).Infof("Definition broadcast '%s' rejected: %s", msg.Header.ID, err)
err = nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for adding this 👍

Fixes regression from hyperledger#1251

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
@awrichar awrichar merged commit d1c4161 into hyperledger:main Apr 21, 2023
@awrichar awrichar deleted the reject branch April 21, 2023 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants