Raise curl connection timeout threshold from 5 to 10 seconds#1439
Merged
Raise curl connection timeout threshold from 5 to 10 seconds#1439
Conversation
To support environments where it takes longer than 5 seconds to establish the HTTPS connection (such as Dokku). Fixes #1436. GUS-W-13013203.
7bc705b to
36e17ab
Compare
Malax
approved these changes
Apr 11, 2023
Merged
edmorley
added a commit
that referenced
this pull request
Aug 24, 2025
In #1439, the timeouts used with curl were set to higher values than we needed for Heroku's build system, in order to prevent timeouts in non-Heroku environments such as Dokku running on underpowered devices (or devices with poor internet connections). However, as seen in recent Honeycomb metrics, these higher timeouts cause longer delays on Heroku before a curl retry if there is a transient S3 connection issue - since the request will wait the full 10 seconds `connect_timeout` before retrying. As such, the defaults have been lowered again to be optimised for running on Heroku, and support for overriding the defaults via env var added to still allow running in other environments. Specifically: - The default connection timeout has been lowered from 10 seconds to 3, but can now be overridden via the env var `CURL_CONNECT_TIMEOUT` - The default total request timeout has been lowered from 120 seconds to 60, but can be overridden via `CURL_TIMEOUT` These env vars cannot be set via Heroku config vars, and must instead be set in the build system environment (or by an earlier buildpack). The env var names match those used by the classic Ruby buildpack: https://github.com/heroku/heroku-buildpack-ruby/blob/a6d124492aafe7f7ee0dd42d7a79284b6552d675/lib/language_pack/fetcher.rb#L47-L53 In addition, the usages of `--silent --show-error` have been replaced with `--no-progress-meter`, which is otherwise identical apart from it allowing warnings to be shown, such as the status messages output during retry attempts (of form: "Will retry in 1 seconds. 3 retries left" etc). Before: ``` -----> Installing Python 3.13.7 curl: (6) Could not resolve host: heroku-buildpack-python.s3.us-east-1.amazonaws.com curl: (6) Could not resolve host: heroku-buildpack-python.s3.us-east-1.amazonaws.com ... ``` After: ``` -----> Installing Python 3.13.7 curl: (7) Failed to connect to heroku-buildpack-python.s3.us-east-1.amazonaws.com port 443 after 3 ms: Couldn't connect to server Warning: Problem : connection refused. Will retry in 1 seconds. 5 retries left. curl: (7) Failed to connect to heroku-buildpack-python.s3.us-east-1.amazonaws.com port 443 after 4 ms: Couldn't connect to server Warning: Problem : connection refused. Will retry in 2 seconds. 4 retries left. ... ``` Lastly, the maximum number of retries has been increased slightly. Note: The curl options used in `build_python_runtime.sh` have also been adjusted, however, since these are only used by buildpack maintainers (typically by running them on GitHub Actions), there is no need to those timeouts configurable. GUS-W-19414036.
edmorley
added a commit
that referenced
this pull request
Aug 24, 2025
In #1439, the timeouts used with curl were set to higher values than we needed for Heroku's build system, in order to prevent timeouts in non-Heroku environments such as Dokku running on underpowered devices (or devices with poor internet connections). However, as seen in recent Honeycomb metrics, these higher timeouts cause longer delays on Heroku before a curl retry if there is a transient S3 connection issue - since the request will wait the full 10 seconds `connect_timeout` before retrying. As such, the defaults have been lowered again to be optimised for running on Heroku, and support for overriding the defaults via env var added to still allow running in other environments. Specifically: - The default connection timeout has been lowered from 10 seconds to 3, but can now be overridden via the env var `CURL_CONNECT_TIMEOUT` - The default total request timeout has been lowered from 120 seconds to 60, but can be overridden via `CURL_TIMEOUT` These env vars cannot be set via Heroku config vars, and must instead be set in the build system environment (or by an earlier buildpack). The env var names match those used by the classic Ruby buildpack: https://github.com/heroku/heroku-buildpack-ruby/blob/a6d124492aafe7f7ee0dd42d7a79284b6552d675/lib/language_pack/fetcher.rb#L47-L53 In addition, the usages of `--silent --show-error` have been replaced with `--no-progress-meter`, which is otherwise identical apart from it allowing warnings to be shown, such as the status messages output during retry attempts (of form: "Will retry in 1 seconds. 3 retries left" etc). Before: ``` -----> Installing Python 3.13.7 curl: (6) Could not resolve host: heroku-buildpack-python.s3.us-east-1.amazonaws.com curl: (6) Could not resolve host: heroku-buildpack-python.s3.us-east-1.amazonaws.com ... ``` After: ``` -----> Installing Python 3.13.7 curl: (7) Failed to connect to heroku-buildpack-python.s3.us-east-1.amazonaws.com port 443 after 3 ms: Couldn't connect to server Warning: Problem : connection refused. Will retry in 1 seconds. 5 retries left. curl: (7) Failed to connect to heroku-buildpack-python.s3.us-east-1.amazonaws.com port 443 after 4 ms: Couldn't connect to server Warning: Problem : connection refused. Will retry in 2 seconds. 4 retries left. ... ``` Lastly, the maximum number of retries has been increased slightly. Note: The curl options used in `build_python_runtime.sh` have also been adjusted, however, since these are only used by buildpack maintainers (typically by running them on GitHub Actions), there is no need to those timeouts configurable. GUS-W-19414036.
edmorley
added a commit
that referenced
this pull request
Aug 24, 2025
In #1439, the timeouts used with curl were set to higher values than we needed for Heroku's build system, in order to prevent timeouts in non-Heroku environments such as Dokku running on underpowered devices (or devices with poor internet connections). However, as seen in recent Honeycomb metrics, these higher timeouts cause longer delays on Heroku before a curl retry if there is a transient S3 connection issue - since the request will wait the full 10 seconds `connect_timeout` before retrying. As such, the defaults have been lowered again to be optimised for running on Heroku, and support for overriding the defaults via env var added to still allow running in other environments. Specifically: - The default connection timeout has been lowered from 10 seconds to 3, but can now be overridden via the env var `CURL_CONNECT_TIMEOUT` - The default total request timeout has been lowered from 120 seconds to 60, but can be overridden via `CURL_TIMEOUT` These env vars cannot be set via Heroku config vars, and must instead be set in the build system environment (or by an earlier buildpack). The env var names match those used by the classic Ruby buildpack: https://github.com/heroku/heroku-buildpack-ruby/blob/a6d124492aafe7f7ee0dd42d7a79284b6552d675/lib/language_pack/fetcher.rb#L47-L53 In addition, the usages of `--silent --show-error` have been replaced with `--no-progress-meter`, which is otherwise identical apart from it allowing warnings to be shown, such as the status messages output during retry attempts (of form: `Will retry in 1 seconds. 3 retries left` etc). Before: ``` -----> Installing Python 3.13.7 curl: (6) Could not resolve host: heroku-buildpack-python.s3.us-east-1.amazonaws.com curl: (6) Could not resolve host: heroku-buildpack-python.s3.us-east-1.amazonaws.com ... ``` After: ``` -----> Installing Python 3.13.7 curl: (7) Failed to connect to heroku-buildpack-python.s3.us-east-1.amazonaws.com port 443 after 3 ms: Couldn't connect to server Warning: Problem : connection refused. Will retry in 1 seconds. 5 retries left. curl: (7) Failed to connect to heroku-buildpack-python.s3.us-east-1.amazonaws.com port 443 after 4 ms: Couldn't connect to server Warning: Problem : connection refused. Will retry in 2 seconds. 4 retries left. ... ``` Lastly, the maximum number of retries has been increased slightly. Note: The curl options used in `build_python_runtime.sh` have also been adjusted, however, since these are only used by buildpack maintainers (typically by running them on GitHub Actions), there is no need to make those timeouts configurable. GUS-W-19414036.
edmorley
added a commit
that referenced
this pull request
Aug 24, 2025
In #1439, the timeouts used with curl were set to higher values than we needed for Heroku's build system, in order to prevent timeouts in non-Heroku environments such as Dokku running on underpowered devices (or devices with poor internet connections). However, as seen in recent Honeycomb metrics, these higher timeouts cause longer delays on Heroku before a curl retry if there is a transient S3 connection issue - since the request will wait the full 10 seconds `connect_timeout` before retrying. As such, the defaults have been lowered again to be optimised for running on Heroku, and support for overriding the defaults via env var added to still allow running in other environments. Specifically: - The default connection timeout has been lowered from 10 seconds to 3, but can now be overridden via the env var `CURL_CONNECT_TIMEOUT` - The default total request timeout has been lowered from 120 seconds to 60, but can be overridden via `CURL_TIMEOUT` These env vars cannot be set via Heroku config vars, and must instead be set in the build system environment (or by an earlier buildpack). The env var names match those used by the classic Ruby buildpack: https://github.com/heroku/heroku-buildpack-ruby/blob/a6d124492aafe7f7ee0dd42d7a79284b6552d675/lib/language_pack/fetcher.rb#L47-L53 In addition, the usages of `--silent --show-error` have been replaced with `--no-progress-meter`, which is otherwise identical apart from it allowing warnings to be shown, such as the status messages output during retry attempts (of form: `Will retry in 1 seconds. 3 retries left` etc). Before: ``` -----> Installing Python 3.13.7 curl: (6) Could not resolve host: heroku-buildpack-python.s3.us-east-1.amazonaws.com curl: (6) Could not resolve host: heroku-buildpack-python.s3.us-east-1.amazonaws.com ... ``` After: ``` -----> Installing Python 3.13.7 curl: (7) Failed to connect to heroku-buildpack-python.s3.us-east-1.amazonaws.com port 443 after 3 ms: Couldn't connect to server Warning: Problem : connection refused. Will retry in 1 seconds. 5 retries left. curl: (7) Failed to connect to heroku-buildpack-python.s3.us-east-1.amazonaws.com port 443 after 4 ms: Couldn't connect to server Warning: Problem : connection refused. Will retry in 2 seconds. 4 retries left. ... ``` Lastly, the maximum number of retries has been increased slightly. Note: The curl options used in `build_python_runtime.sh` have also been adjusted, however, since these are only used by buildpack maintainers (typically by running them on GitHub Actions), there is no need to make those timeouts configurable. GUS-W-19414036.
edmorley
added a commit
that referenced
this pull request
Aug 26, 2025
In #1439, the timeouts used with curl were set to higher values than we needed for Heroku's build system, in order to prevent timeouts in non-Heroku environments such as Dokku running on underpowered devices (or devices with poor internet connections). However, as seen in recent Honeycomb metrics, these higher timeouts cause longer delays on Heroku before a curl retry if there is a transient S3 connection issue - since the request will wait the full 10 seconds `connect_timeout` before retrying. As such, the defaults have been lowered again to be optimised for running on Heroku, and support for overriding the defaults via env var added to still allow running in other environments. Specifically: - The default connection timeout has been lowered from 10 seconds to 3, but can now be overridden via the env var `CURL_CONNECT_TIMEOUT` - The default total request timeout has been lowered from 120 seconds to 60, but can be overridden via `CURL_TIMEOUT` These env vars cannot be set via Heroku config vars, and must instead be set in the build system environment (or by an earlier buildpack). The env var names match those used by the classic Ruby buildpack: https://github.com/heroku/heroku-buildpack-ruby/blob/a6d124492aafe7f7ee0dd42d7a79284b6552d675/lib/language_pack/fetcher.rb#L47-L53 In addition, the usages of `--silent --show-error` have been replaced with `--no-progress-meter`, which is otherwise identical apart from it allowing warnings to be shown, such as the status messages output during retry attempts (of form: `Will retry in 1 seconds. 3 retries left` etc). Before: ``` -----> Installing Python 3.13.7 curl: (6) Could not resolve host: heroku-buildpack-python.s3.us-east-1.amazonaws.com curl: (6) Could not resolve host: heroku-buildpack-python.s3.us-east-1.amazonaws.com ... ``` After: ``` -----> Installing Python 3.13.7 curl: (7) Failed to connect to heroku-buildpack-python.s3.us-east-1.amazonaws.com port 443 after 3 ms: Couldn't connect to server Warning: Problem : connection refused. Will retry in 1 seconds. 5 retries left. curl: (7) Failed to connect to heroku-buildpack-python.s3.us-east-1.amazonaws.com port 443 after 4 ms: Couldn't connect to server Warning: Problem : connection refused. Will retry in 2 seconds. 4 retries left. ... ``` Lastly, the maximum number of retries has been increased slightly. Note: The curl options used in `build_python_runtime.sh` have also been adjusted, however, since these are only used by buildpack maintainers (typically by running them on GitHub Actions), there is no need to make those timeouts configurable. GUS-W-19414036.
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.
To support environments where it takes longer than 5 seconds to establish the HTTPS connection (such as Dokku).
Fixes #1436.
GUS-W-13013203.