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

go/runtime/host/multi: Propagate consensus sync requests to next version #5433

Merged
merged 1 commit into from
Nov 8, 2023

Conversation

kostko
Copy link
Member

@kostko kostko commented Nov 8, 2023

Previously periodic consensus sync requests were not propagated to the next (e.g. upcoming) runtime version. This could result in the runtime's consensus view going stale which would make the attestations too old so they would be rejected during scheduling.

@kostko kostko force-pushed the kostko/fix/rt-host-multi-propagate-sync branch from 04b29ac to 7a9b9a6 Compare November 8, 2023 08:57
@kostko kostko marked this pull request as ready for review November 8, 2023 08:58
Copy link

codecov bot commented Nov 8, 2023

Codecov Report

Merging #5433 (7a9b9a6) into master (626172d) will decrease coverage by 0.60%.
Report is 1 commits behind head on master.
The diff coverage is 50.00%.

❗ Current head 7a9b9a6 differs from pull request most recent head 0ffa2f9. Consider uploading reports for the commit 0ffa2f9 to get more accurate results

@@            Coverage Diff             @@
##           master    #5433      +/-   ##
==========================================
- Coverage   66.96%   66.37%   -0.60%     
==========================================
  Files         533      533              
  Lines       56365    56375      +10     
==========================================
- Hits        37746    37419     -327     
- Misses      14236    14530     +294     
- Partials     4383     4426      +43     
Files Coverage Δ
go/runtime/host/multi/multi.go 65.07% <50.00%> (-1.45%) ⬇️

... and 70 files with indirect coverage changes

Copy link
Contributor

@peternose peternose left a comment

Choose a reason for hiding this comment

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

Looks good, I would just reorder lines to keep host := agg.active.host together with if check, and host.Call together with its error handling.

We could also call the next host in a go routine, to speed things up. Not sure if needed, though.

Not part of this PR, but it looks like call could be removed from the retry. It would be more obvious that call to next rt will only be made once if retried multiple times.

	var (
		activeHost host.Runtime
		nextHost   host.Runtime
	)

	callFn := func() error {
		agg.l.RLock()
		defer agg.l.RUnlock()

		if agg.active == nil {
			return ErrNoActiveVersion
		}
		activeHost = agg.active.host

		if agg.next != nil {
			nextHost = agg.next.host
		}

		return nil
	}

@kostko kostko force-pushed the kostko/fix/rt-host-multi-propagate-sync branch from 7a9b9a6 to 73417e6 Compare November 8, 2023 11:16
_, nextErr := nextHost.Call(ctx, body)
if nextErr != nil {
agg.logger.Warn("failed to propagate runtime request to next version",
"id", agg.ID(),
Copy link
Contributor

Choose a reason for hiding this comment

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

In another PR we could also update the logger, e.g. logging.GetLogger("runtime/host/multi").With("id", id). I guess here the version is important, but it can also be read from the logs.

Previously periodic consensus sync requests were not propagated to the
next (e.g. upcoming) runtime version. This could result in the runtime's
consensus view going stale which would make the attestations too old so
they would be rejected during scheduling.

Additionally, key manager update requests should also be propagated to
ensure the runtime is ready immediately when activated, avoiding any
potential race conditions.
@kostko kostko force-pushed the kostko/fix/rt-host-multi-propagate-sync branch from 73417e6 to 0ffa2f9 Compare November 8, 2023 11:57
@kostko kostko merged commit 297090c into master Nov 8, 2023
@kostko kostko deleted the kostko/fix/rt-host-multi-propagate-sync branch November 8, 2023 13:14
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.

2 participants