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

Use upstream net-http-persistent, connection_pool (un-vendored) #345

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

nevans
Copy link

@nevans nevans commented Feb 24, 2025

net-http-persistent and connection_pool were vendored, and have gotten very out-of-date. This resets to use the upstream gems.

connection-pool is upgraded from 2.2.0 to 2.4+:

  • 2.2.5 fixes argument forwarding for ruby 2.7+.
  • 2.4.0 automatically drops all connections after fork.

net-http-persistent is upgraded from 3.0.0 (forked) to 4.0.2+:

  • 4.0.2 fixes compatibility with connection-pool 2.4
  • 3.1.0 supports TLS min/max and IPv6 (also in vendored fork)
  • 3.1.0 fixes a memory leak in connection pooling.
  • Many many bugfixes
  • some vendored fork differences were removed:
    • use :name, :pool_size kwargs for .new

One change to the vendored fork was reimplemented: upstream does not support timeout kwarg for .new, nor does connection_pool expose an accessor for its timeout. So this code reaches into the pool and sets the @timeout ivar directly.

Additionally, all of the exceptions which net-http handles (in Net::HTTP#transport_request) are added to RESCUED_EXCEPTIONS. Net::HTTP uses these to determine whether the socket should be closed (and whether idempotent requests should be retried).

Additionally, other changes were made so CI would pass:

  • minimum ruby was set to match ruby's EOL.
  • the CI matrix was updated to reflect more recent ruby and vault versions
  • base64 was added as an explicit dependency, for ruby 3.4

This drops support for all EOL ruby versions.
Dropped 1.11: EOL since 2023-06-21 (last release was 2023-06-19)
Dropped 1.12: EOL since 2023-09-27 (last release was 2023-09-11)
Dropped 1.13: EOL since 2024-03-25 (last release was 2024-01-29)

Added 1.14: EOL since 2024-06-10 (last release was 2024-02-28)
Added 1.15: EOL since 2024-06-10 (last release was 2024-02-28)
Added 1.16: EOL since 2024-06-10 (last release was 2024-05-29)
Added 1.17: EOL since 2024-10-09 (last release was 2024-09-24)
Added 1.18: current release      (last release was 2025-01-29)

1.16 has LTS until 2026-03-15 (Vault Enterprise only).

I kept unsupported releases all the way back to 1.14 only because I have
to support a 1.14 server that hasn't been upgraded (yet). 😔
`net-http-persistent` and `connection_pool` were vendored, and have
gotten very out-of-date.  This resets to use the upstream gems.

`connection-pool` is upgraded from 2.2.0 to 2.4+:
* 2.2.5 fixes argument forwarding for ruby 2.7+.
* 2.4.0 automatically drops all connections after fork.

`net-http-persistent` is upgraded from 3.0.0 (forked) to 4.0.2+:
* 4.0.2 fixes compatibility with `connection-pool` 2.4
* 3.1.0 supports TLS min/max and IPv6 (also in vendored fork)
* 3.1.0 fixes a memory leak in connection pooling.
* some vendored fork differences were removed:
  * use :name, :pool_size kwargs for .new

One change to the vendored fork was reimplemented: upstream does _not_
support timeout kwarg for .new, nor does `connection_pool` expose an
accessor for its `timeout`.  So this code reaches into the pool and sets
the `@timeout` ivar directly.
These exceptions are copied from the list of exceptions which Net::HTTP
uses in `#transport_request` to determin whether the socket should be
closed (and retried, for idempotent requests).
@nevans nevans requested a review from a team as a code owner February 24, 2025 21:54
Copy link

hashicorp-cla-app bot commented Feb 24, 2025

CLA assistant check
All committers have signed the CLA.

@nevans nevans changed the title Un-vendor gems: upgrade net-http-persistent and connection_pool Use upstream net-http-persistent and connection_pool (un-vendored) Feb 24, 2025
@nevans nevans changed the title Use upstream net-http-persistent and connection_pool (un-vendored) Use upstream net-http-persistent, connection_pool (un-vendored) Feb 24, 2025
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.

None yet

1 participant