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

Fix: Stuck build containers #836

Merged
merged 18 commits into from
Jan 17, 2025
Merged

Fix: Stuck build containers #836

merged 18 commits into from
Jan 17, 2025

Conversation

dleviminzi
Copy link
Collaborator

@dleviminzi dleviminzi commented Jan 9, 2025

Resolve BE-2203

This PR contains to work to fix one of the likely causes of stuck build workers. Basically, if a user cancels a build (Ctrl-C) before the build container has started, the worker will get stuck. As things are, the entire build will carry on as if nothing happened and then the container will just sit there forever.

To prevent this from happening we can use redis pub/sub. When the context is cancelled in the gateway, we publish a stop-build event to a channel containing the container id (stop-build-{container_id}). Meanwhile, when the worker claims the container request, it subscribes to that same channel. If an event comes through it cancels the context that has been passed down.

pkg/scheduler/scheduler.go Outdated Show resolved Hide resolved
pkg/worker/worker.go Outdated Show resolved Hide resolved
pkg/worker/worker.go Outdated Show resolved Hide resolved
pkg/abstractions/image/build.go Show resolved Hide resolved
pkg/abstractions/image/build.go Show resolved Hide resolved
@dleviminzi dleviminzi requested a review from jsun-m January 14, 2025 01:36
pkg/worker/worker.go Show resolved Hide resolved
pkg/abstractions/image/build.go Outdated Show resolved Hide resolved
@dleviminzi dleviminzi merged commit af9190c into main Jan 17, 2025
3 checks passed
@dleviminzi dleviminzi deleted the dlm/stuck-build-containers branch January 17, 2025 14:47
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