Title: Investigate memory leaks in Cloudflare · Issue #19475 · getsentry/sentry-javascript · GitHub
Open Graph Title: Investigate memory leaks in Cloudflare · Issue #19475 · getsentry/sentry-javascript
X Title: Investigate memory leaks in Cloudflare · Issue #19475 · getsentry/sentry-javascript
Description: Description There are quite some memory leaks in Cloudflare. One of the biggest one is that the CloudflareClient can't be garbage collected and stays in memory forever, this is actually working as expected, as usually we only have one cl...
Open Graph Description: Description There are quite some memory leaks in Cloudflare. One of the biggest one is that the CloudflareClient can't be garbage collected and stays in memory forever, this is actually working as ...
X Description: Description There are quite some memory leaks in Cloudflare. One of the biggest one is that the CloudflareClient can't be garbage collected and stays in memory forever, this is actually working...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/19475
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Investigate memory leaks in Cloudflare","articleBody":"### Description\n\nThere are quite some memory leaks in Cloudflare. One of the biggest one is that the `CloudflareClient` can't be garbage collected and stays in memory forever, this is actually working as expected, as usually we only have one client and it is usually never removed. \n\nIn Cloudflare Workers we actually don't know how long isolates live. So when a lot of requests come in rather fast the request is actually done, but the client is still active, which takes some memory - this could lead to OOM of the worker, as it is limited currently to [128MB](https://developers.cloudflare.com/workers/platform/limits/) per worker.\n\n\n## Possible solution\n\nWe don't know how long an isolate will live, but we do now how long a request takes (as we can hook into all `waitUntil`). ~As an isolate can't be reused it is guaranteed that a new request will spawn a new isolate and therefore a new client.~ Since we spawn a new client per request and a request is not reused, we do have a lot of stale clients. With that it is safe to assume that we can mark an client as \"disposed\" so it can be garbage collected.\n\n## Repro\n\nhttps://github.com/JPeer264/temp-cloudflare-leak\n\nThere is a reproduction showing the memory leak over time. There is also an experimental fix applied, which disposes clients.\n\n","author":{"url":"https://github.com/JPeer264","@type":"Person","name":"JPeer264"},"datePublished":"2026-02-23T16:51:31Z","url":"https://github.com/getsentry/sentry-javascript/issues/19475"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c5f08655-3da9-78e3-e5fe-af755d597030 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C6EA:2FE7CE:2CD3B7:3DA691:6B04BA09 |
| html-safe-nonce | 265bd3f34f0b9ada65a83ee5da79439cabb7409fe5ce2a49bd92636ea36181a8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNkVBOjJGRTdDRToyQ0QzQjc6M0RBNjkxOjZCMDRCQTA5IiwidmlzaXRvcl9pZCI6IjE3NjgwMzkwMTczNjQxMDk4MzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ac1a66ac4fec2f1e968ffececef9bc6aa533014ac6a27beb8524321278b25ce1 |
| hovercard-subject-tag | issue:3979163849 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/19475/issue_layout |
| twitter:image | https://opengraph.githubassets.com/425f65cdca2cea0f03573e09d9675e46f5352980d3dd369f22c133904f1bb2ec/getsentry/sentry-javascript/issues/19475 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/425f65cdca2cea0f03573e09d9675e46f5352980d3dd369f22c133904f1bb2ec/getsentry/sentry-javascript/issues/19475 |
| og:image:alt | Description There are quite some memory leaks in Cloudflare. One of the biggest one is that the CloudflareClient can't be garbage collected and stays in memory forever, this is actually working as ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JPeer264 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 378bd702ac792b3550e484ad39d9a898fcd25bb52ba6962b0c9cc457c1ea71c7 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b032e77f1ea437ede6c115446a0a467709b468e7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width