Skip to content

Add cc uploader configurable drain timeout #562

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

kathap
Copy link
Contributor

@kathap kathap commented Jul 18, 2025

  • 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

Thanks 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 develop branch

  • [] I have run CF Acceptance Tests on bosh lite

- 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 kathap marked this pull request as draft July 18, 2025 16:51
@kathap kathap force-pushed the cc-uploader-drain-timeout branch from b7f8344 to ae3cd55 Compare July 22, 2025 13:55
@kathap kathap marked this pull request as ready for review July 24, 2025 07:05
TIMEOUT_MINUTES="<%= p("capi.cc_uploader.cc_uploader_drain_timeout_in_minutes") %>"

TIMEOUT_MINUTES="${TIMEOUT_MINUTES%m}"
TIMEOUT_MINUTES="${TIMEOUT_MINUTES:-15}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary? The default is defined as "15m" above.

TIMEOUT_MINUTES="${TIMEOUT_MINUTES%m}"
TIMEOUT_MINUTES="${TIMEOUT_MINUTES:-15}"

DRAIN_TIMEOUT=$(( TIMEOUT_MINUTES * 60 ))
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be renamed to "TIMEOUT_SECONDS"

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"
Copy link
Contributor

Choose a reason for hiding this comment

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

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?

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.

2 participants