-
Notifications
You must be signed in to change notification settings - Fork 284
fix: handle docker container startup race condition in local provisioner #2134
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
base: main
Are you sure you want to change the base?
Conversation
Replace panic with proper error handling when creating exec commands in containers that are still starting up. The previous implementation would panic with a 409 error when the container was not yet running, causing shuttle run to crash. This change adds retry logic with container state inspection to gracefully wait for containers to become ready, distinguishing between transient startup delays and actual failures. fixes shuttle-hq#2133
Greptile OverviewGreptile SummaryThis PR fixes a race condition where Key changes:
Suggestions:
Confidence Score: 4/5
Important Files ChangedFile Analysis
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (1)
-
cargo-shuttle/src/provisioner_server.rs, line 246-318 (link)style: Add function-level documentation explaining the retry logic and race condition handling.
Context Used: Context from
dashboard- Include comments explaining the purpose of functions, especially for new or complex functionality. (source)
1 file reviewed, 2 comments
|
Hi, can anyone look at this PR so that the DB startup issue can be fixed? Thank you. |
Replaced panic with proper error handling when creating exec commands in containers that are still starting up. The previous implementation would panic with a 409 error when the container was not yet running, causing shuttle run to crash.
This change adds retry logic with container state inspection to gracefully wait for containers to become ready, distinguishing between transient startup delays and actual failures.
Changes made
.expect()calls with properResulterror handling usingbail!()and.context()Closes #2133
How has this been tested?
Tested locally with
shuttle runusing a project withDatabaseSharedPostgresresource. The container now starts successfully without panicking, properly waiting for the container to be ready before attempting to execute commands.