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

Detect changes in supported platforms without requiring restart #1291

Closed
tonistiigi opened this issue Dec 16, 2019 · 3 comments · Fixed by #1381
Closed

Detect changes in supported platforms without requiring restart #1291

tonistiigi opened this issue Dec 16, 2019 · 3 comments · Fixed by #1381

Comments

@tonistiigi
Copy link
Member

Currently, after installing qemu-user support, the daemon needs to be restarted for it to detect the support again. This is because there is a cache to avoid running the relatively costly detection algorithm again.

I think there is a version that could work for both cases. We could implement SupportedPlatfroms(resetCache) and ResetCache(platform). If you run something like buildctl debug workers we would always rescan the platforms support. If you build for a specific platform then if it is supported we would just return true, if it is not supported we would reset cache for that specific platform. Then 99% of the builds that do not return an error would still keep using cache.

related docker/buildx#208

@jingxiaolu
Copy link
Contributor

@tonistiigi
Do you mean updates the code procedure as this?

CMD: buildctl debug workers

buildctl listWorkers()
	c.ListWorkers()
		c.controlClient().ListWorkers()
	
<---Buildctl
GRPC: /moby.buildkit.v1.Control/ListWorkers
--->Buildkitd 
Controller ListWorkers()
	c.opt.WorkerController.ResetCache()  // <-- new
	c.opt.WorkerController.List()
	prepare resp and return
	
Worker.Controller ResetCache()  // <-- new
	workers := c.List()
	for range workers
		worker.ResetCache()

Worker ResetCache()  // <-- new
	updatedPlatforms = binfmt_misc.SupportedPlatforms(true)
	w.WorkerOpt.Platforms = parse(updatedPlatforms)
	
binfmt_misc SupportedPlatforms(resetCache bool)		// <-- resetCache bool is newly added
	if resetCache 
		rescan platform and return

@tonistiigi
Copy link
Member Author

@jingxiaolu Yes. But more importantly, there is a rescan for a specific platform in the beginning of the build request if requested platform is not already supported.

@jingxiaolu
Copy link
Contributor

@tonistiigi
Currently in SupportedPlatforms() there has a once.Do() and the checkings are wrapped by it. We need remove this once.Do()?

If so, when buildkitd boots up, it may scans platforms twice here:

	if cfg.Workers.OCI.Platforms == nil {
		cfg.Workers.OCI.Platforms = binfmt_misc.SupportedPlatforms()
	}
	if cfg.Workers.Containerd.Platforms == nil {
		cfg.Workers.Containerd.Platforms = binfmt_misc.SupportedPlatforms()
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants