• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stripe / stripe-ruby
96%
master: 97%

Build:
Build:
LAST BUILD BRANCH: HEAD
DEFAULT BRANCH: master
Repo Added 09 Dec 2017 01:25AM UTC
Files 262
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH brandur-connection-manager-gc
branch: brandur-connection-manager-gc
CHANGE BRANCH
x
Reset
  • brandur-connection-manager-gc
  • HEAD
  • akropp-add-client-telemetry
  • akropp-telemetry-in-ms
  • alexander/flexible-billing
  • anniel-coveralls
  • anniel-test-coverage
  • beta
  • brandur-assert-raises
  • brandur-backwards-auto-paging-each
  • brandur-check-request-id
  • brandur-clean-test-output
  • brandur-clearable-connections
  • brandur-configuration-ca-bundle-path
  • brandur-configuring-version
  • brandur-deleted-objects-with-ids
  • brandur-disable-lengths
  • brandur-drop-old-ruby
  • brandur-drop-timecop
  • brandur-exclude-examples
  • brandur-expand-retries
  • brandur-expose-compute-signature
  • brandur-fix-delete-discount
  • brandur-fix-query-encoding
  • brandur-fix-tests
  • brandur-frozen-strings
  • brandur-generate-header
  • brandur-hash
  • brandur-idempotent-replayed
  • brandur-initialize-instance-var
  • brandur-integer-indexes
  • brandur-keep-alive-to-30
  • brandur-merge-query-params
  • brandur-minor-refactor
  • brandur-minor-stripe-client-cleanup
  • brandur-minor-test-fixes
  • brandur-monotonic-time
  • brandur-named-code
  • brandur-net-http
  • brandur-net-http-persistent
  • brandur-nicer-error
  • brandur-only-empty-metadata
  • brandur-port-in-output
  • brandur-raise-argument-error
  • brandur-relax-file-constraints
  • brandur-remove-deprecated
  • brandur-remove-file-encoding
  • brandur-rename-request
  • brandur-request-begin
  • brandur-request-id-test
  • brandur-retry-fix
  • brandur-retry-lock-timeouts
  • brandur-rubocop-080
  • brandur-ruby-20
  • brandur-ruby-21
  • brandur-ruby-25
  • brandur-select-port
  • brandur-shoulda-context-2-0-0-rc4
  • brandur-simpler-encoding
  • brandur-stripe-mock-0-15
  • brandur-stripe-mock-030
  • brandur-stripe-mock-v0.12.0
  • brandur-stripe-should-retry
  • brandur-support-express-authorize
  • brandur-thread-state
  • brandur-warn-on-remove-error
  • brandur-webmock-380
  • cjavilla/add-playlist-link-to-readme
  • cjavilla/update-readme
  • ctrudeau-add-code-generated-comment-to-ruby
  • daz-terminal-bindings
  • fay/issfr
  • fay/update-version
  • foresthu-add-topup-cancel-support
  • integration-v5
  • jkakar/fix-product-issues
  • jkakar/topup-client
  • latest-codegen
  • master
  • metadata-api
  • mickjermsurawong/update-stripe-mock-version
  • ob-better-resource-url
  • ob-bump-faraday
  • ob-bump-rubocop
  • ob-creditnote-preview
  • ob-decimal-string
  • ob-dsl-custom-method
  • ob-early-fraud-warning
  • ob-enable-telemetry
  • ob-error-code
  • ob-error-object
  • ob-file-duck-typing
  • ob-file-link
  • ob-file-resource
  • ob-fix-ci
  • ob-fix-tests
  • ob-fix-windows
  • ob-gem-metadata
  • ob-github-actions
  • ob-irc-badge
  • ob-oauth
  • ob-openapi-files
  • ob-prep-file
  • ob-proxy
  • ob-remove-all
  • ob-remove-issuerfraudrecord
  • ob-remove-old-methods
  • ob-rubocop
  • ob-serialize-individual
  • ob-skip-to-hash-for-nil
  • ob-static-methods
  • ob-stripe-mock-0.11.0
  • ob-test-file-link-data
  • ob-topup-cancel
  • ob-travis-bundler
  • ob-travis-ruby26
  • ob-upcoming-line-items
  • ob-upgrade-stripe-mock
  • ob-vscode
  • ob/codegen-40a20cd
  • ob/codegen-63fe31a
  • ob/codegen-ab6898a
  • ob/codegen-ba4dcd0
  • ob/codegen-c806fa1
  • pavel/codegen
  • pavel/more-inheritance
  • pavel/more-method-sorting
  • pavel/normalize-opts
  • pavel/simplify-inheritance
  • pavel/single-quotes
  • ralex/codegen
  • ralex/codegen-2
  • ralex/fix-initialize-from
  • ralex/list-urs-and-st
  • ralex/unified_requests
  • rattrayalex-stripe-patch-1
  • rattrayalex/codegen-c806fa1
  • rattrayalex/codegen-f7fc004
  • remi-add-account-capabilities
  • remi-add-account-links
  • remi-add-checkout-session-retrieve
  • remi-add-checkout-sessions
  • remi-add-credit-notes
  • remi-add-creditnote
  • remi-add-customer-balance-transactions
  • remi-add-invoice-methods
  • remi-add-issuing-resources
  • remi-add-mandate
  • remi-add-payment-intent
  • remi-add-payment-methods
  • remi-add-person
  • remi-add-radar-lists
  • remi-add-radar-review
  • remi-add-reporting-resources
  • remi-add-sigma-scheduled-query-run
  • remi-add-subscription-schedules
  • remi-add-tax-ids
  • remi-add-tax-rates
  • remi-add-terminal-delete
  • remi-add-usage-record-summary
  • remi-add-webhook-endpoint
  • remi-bring-nested-tests-up
  • remi-change-readme
  • remi-fix-bt
  • remi-fix-checkout-sessions
  • remi-fix-payment-intent
  • remi-fix-readme
  • remi-fix-tests
  • remi-fix-tests-latest
  • remi-move-payment-intent-stripe-mock
  • remi-scheduled-run-mock
  • remi-setupintents
  • remi-wip-creditnote-line
  • remi/codegen-3854362
  • remi/codegen-474461f
  • remi/codegen-4bd4c01
  • remi/codegen-72527e3
  • remi/codegen-824d494
  • remi/codegen-d663cdb
  • remi/codegen-f71053e
  • remi/codegen-f75fd88
  • richardm-apiref-link
  • richardm-billingportalconfig
  • richardm-generate-via-stripetype
  • richardm-gha
  • richardm-junit-output
  • rubocop-0.79
  • rwz/inline-paths
  • rwz/sort-methods
  • sdk-release/next-major
  • tmaxwell/fix-connect-base
  • tomer-remove-edittable-bitcoin-receivers-actions
  • v3.10.0
  • v3.11.0
  • v3.12.0
  • v3.12.1
  • v3.13.0
  • v3.13.1
  • v3.14.0
  • v3.15.0
  • v3.16.0
  • v3.17.0
  • v3.17.1
  • v3.17.2
  • v3.18.0
  • v3.19.0
  • v3.20.0
  • v3.21.0
  • v3.22.0
  • v3.23.0
  • v3.24.0
  • v3.25.0
  • v3.26.0
  • v3.26.1
  • v3.27.0
  • v3.28.0
  • v3.29.0
  • v3.30.0
  • v3.31.0
  • v3.31.1
  • v3.9.1
  • v3.9.2
  • v4.0.0
  • v4.0.1
  • v4.0.2
  • v4.0.3
  • v4.1.0
  • v4.10.0
  • v4.11.0
  • v4.12.0
  • v4.13.0
  • v4.14.0
  • v4.15.0
  • v4.16.0
  • v4.17.0
  • v4.18.0
  • v4.18.1
  • v4.19.0
  • v4.2.0
  • v4.20.0
  • v4.20.1
  • v4.21.0
  • v4.21.1
  • v4.21.2
  • v4.21.3
  • v4.22.0
  • v4.22.1
  • v4.23.0
  • v4.3.0
  • v4.4.0
  • v4.4.1
  • v4.5.0
  • v4.6.0
  • v4.7.0
  • v4.7.1
  • v4.8.0
  • v4.8.1
  • v4.9.0
  • v4.9.1
  • v5.0.0
  • v5.0.1
  • v5.1.0
  • v5.1.1
  • v5.10.0
  • v5.11.0
  • v5.12.0
  • v5.12.1
  • v5.13.0
  • v5.14.0
  • v5.15.0
  • v5.16.0
  • v5.17.0
  • v5.18.0
  • v5.19.0
  • v5.2.0
  • v5.20.0
  • v5.21.0
  • v5.22.0
  • v5.23.0
  • v5.23.1
  • v5.24.0
  • v5.25.0
  • v5.26.0
  • v5.27.0
  • v5.28.0
  • v5.29.0
  • v5.29.1
  • v5.3.0
  • v5.30.0
  • v5.4.0
  • v5.4.1
  • v5.5.0
  • v5.6.0
  • v5.7.0
  • v5.7.1
  • v5.8.0
  • v5.9.0
  • zwick_set_app_info_partner_updates

pending completion
3444

Pull #851

travis-ci

web-flow
Introduce system for garbage collecting connection managers

Introduces a system for garbage collecting connection managers in an
attempt to solve #850.

Previously, the number of connection managers (and by extension the
number of connections that they were holding) would stay stable if a
program used a stable number of threads. However, if threads were used
disposably, the number of active connection managers out there could
continue to grow unchecked, and each of those could be holding one or
more dead connections which are no longer open, but still holding a file
descriptor waiting to be unlinked in disposed of by Ruby's GC.

This PR introduces a connection manager garbage collector that runs
periodically whenever a new connection manager is created. Connection
managers get a timestamp to indicate when they were last used, and the
GC runs through each one and prunes any that haven't seen use within a
certain threshold (currently, 120 seconds). This should have the effect
of removing connection managers as they're not needed anymore, and thus
resolving the socket leakage seen in #850.

I had to make a couple implementation tweaks to get this working
correctly. Namely:

* The `StripeClient` class now tracks thread contexts instead of
  connection managers. This is so that when we're disposing of a
  connection manager, we can set `default_connection_manager` on its
  parent thread context to `nil` so that it's not still tracking a
  connection manager that we're trying to get rid of.

* `StripeClient` instances can still be instantiated as before, but no
  longer internalize a reference to their own connection manager,
  instead falling back to the one in the current thread context. The
  rationale is that when trying to dispose of a connection manager, we'd
  also have to dispose of its reference in any outstanding
  `StripeClient` instances that might still be tracking it, and that
  starts to get a little unwieldy. I've left `#connection_manager`... (continued)
Pull Request #851: Introduce system for garbage collecting connection managers

53 of 53 new or added lines in 2 files covered. (100.0%)

7586 of 7894 relevant lines covered (96.1%)

2398.4 hits per line

Relevant lines Covered
Build:
Build:
7894 RELEVANT LINES 7586 COVERED LINES
2398.4 HITS PER LINE
Source Files on brandur-connection-manager-gc
  • List 0
  • Changed 5
  • Source Changed 2
  • Coverage Changed 5
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
3444 brandur-connection-manager-gc Introduce system for garbage collecting connection managers Introduces a system for garbage collecting connection managers in an attempt to solve #850. Previously, the number of connection managers (and by extension the number of connections tha... Pull #851 20 Sep 2019 06:28AM UTC web-flow travis-ci pending completion  
3443 brandur-connection-manager-gc Introduce system for garbage collecting connection managers Introduces a system for garbage collecting connection managers in an attempt to solve #850. Previously, the number of connection managers (and by extension the number of connections tha... push 20 Sep 2019 06:28AM UTC brandur travis-ci pending completion  
3442 brandur-connection-manager-gc Introduce system for garbage collecting connection managers Introduces a system for garbage collecting connection managers in an attempt to solve #850. Previously, the number of connection managers (and by extension the number of connections tha... Pull #851 20 Sep 2019 06:20AM UTC web-flow travis-ci pending completion  
3441 brandur-connection-manager-gc Introduce system for garbage collecting connection managers Introduces a system for garbage collecting connection managers in an attempt to solve #850. Previously, the number of connection managers (and by extension the number of connections tha... push 20 Sep 2019 06:19AM UTC brandur travis-ci pending completion  
3440 brandur-connection-manager-gc Introduce system for garbage collecting connection managers Introduces a system for garbage collecting connection managers in an attempt to solve #850. Previously, the number of connection managers (and by extension the number of connections tha... Pull #851 19 Sep 2019 11:57PM UTC web-flow travis-ci pending completion  
3439 brandur-connection-manager-gc Introduce system for garbage collecting connection managers Introduces a system for garbage collecting connection managers in an attempt to solve #850. Previously, the number of connection managers (and by extension the number of connections tha... push 19 Sep 2019 11:57PM UTC brandur travis-ci pending completion  
3438 brandur-connection-manager-gc Introduce system for garbage collecting connection managers Introduces a system for garbage collecting connection managers in an attempt to solve #850. Previously, the number of connection managers (and by extension the number of connections tha... Pull #851 19 Sep 2019 11:39PM UTC web-flow travis-ci pending completion  
3437 brandur-connection-manager-gc Introduce system for garbage collecting connection managers Introduces a system for garbage collecting connection managers in an attempt to solve #850. Previously, the number of connection managers (and by extension the number of connections tha... push 19 Sep 2019 11:38PM UTC brandur travis-ci pending completion  
See All Builds (4151)
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc