Add cc uploader configurable drain timeout - #562
Merged
Conversation
- Add `capi.cc_uploader.cc_uploader_drain_timeout_in_minutes` (type: time, default: 15m) to job spec
- Inject `--shutdownTimeoutInMinutes=<%= p("capi.cc_uploader.cc_uploader_drain_timeout_in_minutes") %>` into `bpm.yml.erb`
- Update `drain.sh.erb` to read the same property, apply the timeout when waiting for PID exit
- Retain 15-minute fallback in the script for robustness against missing property values
kathap
marked this pull request as draft
July 18, 2025 16:51
kathap
force-pushed
the
cc-uploader-drain-timeout
branch
from
July 22, 2025 13:55
b7f8344 to
ae3cd55
Compare
kathap
marked this pull request as ready for review
July 24, 2025 07:05
jochenehret
reviewed
Jul 24, 2025
| NOW_TS=$(date +%s) | ||
| ELAPSED=$(( NOW_TS - START_TS )) | ||
| if [ "$ELAPSED" -ge "$DRAIN_TIMEOUT" ]; then | ||
| echo "$(date): drain timeout reached after ${DRAIN_TIMEOUT}s, forcing exit" >> "$LOG_FILE" |
Contributor
There was a problem hiding this comment.
So here the timeout is reached and the process has not yet exited. Is it correct to exit the drain script with 0 and send 0 to BOSH in that case?
Contributor
Author
There was a problem hiding this comment.
Yes, in this case it is correct, the drain script is not failing, the upload is just taking too long, so we waited for 15 minutes and then we let bosh go ahead and stop the jobs, which adds another 60s waiting time. If the upload does not finish in that time, diego will send another upload request to another VM.
kathap
force-pushed
the
cc-uploader-drain-timeout
branch
from
July 29, 2025 08:33
5501cd8 to
821b3d5
Compare
jochenehret
reviewed
Sep 15, 2025
jochenehret
approved these changes
Sep 15, 2025
jochenehret
left a comment
Contributor
There was a problem hiding this comment.
Looks good, just consider renaming the drain template file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
capi.cc_uploader.cc_uploader_drain_timeout_in_minutes(type: time, default: 15) to job spec--shutdownTimeoutInMinutes=<%= p("capi.cc_uploader.cc_uploader_drain_timeout_in_minutes") %>intobpm.yml.erbdrain.sh.erbto read the same property, apply the timeout when waiting for PID exitThanks for contributing to the
capi_release. To speed up the process of reviewing your pull request please provide us with:A short explanation of the proposed change:
Allow operators to tune how long the CC-Uploader waits for in-flight uploads to finish during drain by introducing a new BOSH property (capi.cc_uploader.cc_uploader_drain_timeout_in_minutes) with a sane default of 15 minutes, wiring it through both the BPM startup flags and the drain script.
An explanation of the use cases your change solves
Let operators configure how long CC-Uploader waits (with a default of 15 minutes) during VM shutdown so active uploads complete gracefully.
Links to any other associated PRs
Improve droplet upload draining cc-uploader#245
I have viewed signed and have submitted the Contributor License Agreement
I have made this pull request to the
developbranch[] I have run CF Acceptance Tests on bosh lite