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

build: fix resolvedNode cache and panic protection #2467

Merged
merged 2 commits into from
May 22, 2024

Conversation

tonistiigi
Copy link
Member

fixes #2464

In addition to panic fix in the second commit, this fixes the inefficiency where driver.Boot could be called multiple times, resulting multiple docker API calls for example in the case of container driver.

I put the fixes to multiple commits in case we want to only cherry pick the second one but the first one is also pretty bad imho.

This could use further refactoring. Passing the nil logger should not be necessary if all the resolvedNode instances are guaranteed to already be booted and caps loaded.

Currently it is possible for boot() to be called
multiple times, resulting multiple slow requests to
establish connection (eg. multiple container inspects
for container driver).

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
resolveNode methods can call with nil logger. Although
the results should already be cached now in resolver
this makes the protection more explicit.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@tonistiigi tonistiigi added this to the v0.14.1 milestone May 20, 2024
@tonistiigi tonistiigi requested a review from jedevc May 20, 2024 23:49
@@ -179,6 +194,7 @@ func (r *nodeResolver) resolve(ctx context.Context, ps []specs.Platform, pw prog
resolver: r,
driverIndex: 0,
})
nodeIdxs = append(nodeIdxs, 0)
Copy link
Member Author

Choose a reason for hiding this comment

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

This seemed to be another issue. Atm. because first boot was called with empty index array this accidentally saved us from one more extra uncached call (the real first boot happened when opts() was first called). Now there is one more call to boot() but because all calls are cached the number of calls does not matter anymore.

@thompson-shaun thompson-shaun modified the milestones: v0.14.1, v0.15.0 May 22, 2024
@tonistiigi tonistiigi merged commit 37c4ff0 into docker:master May 22, 2024
102 checks passed
@tonistiigi tonistiigi modified the milestones: v0.15.0, v0.14.1 May 22, 2024
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.

Panic when re-bootstrapping driver in non Running state
3 participants