Title: Disable `keepalive` for error fetch requests · Issue #7546 · getsentry/sentry-javascript · GitHub
Open Graph Title: Disable `keepalive` for error fetch requests · Issue #7546 · getsentry/sentry-javascript
X Title: Disable `keepalive` for error fetch requests · Issue #7546 · getsentry/sentry-javascript
Description: We have introduced keepalive in #5697. However, there have been some reports (e.g. #6049) that users have pending HTTP requests, probably due to this. We should set this flag to false for error events, and only set this flag for replays ...
Open Graph Description: We have introduced keepalive in #5697. However, there have been some reports (e.g. #6049) that users have pending HTTP requests, probably due to this. We should set this flag to false for error eve...
X Description: We have introduced keepalive in #5697. However, there have been some reports (e.g. #6049) that users have pending HTTP requests, probably due to this. We should set this flag to false for error eve...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/7546
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Disable `keepalive` for error fetch requests","articleBody":"We have introduced `keepalive` in https://github.com/getsentry/sentry-javascript/pull/5697. However, there have been some reports (e.g. https://github.com/getsentry/sentry-javascript/issues/6049) that users have pending HTTP requests, probably due to this.\r\n\r\nWe should set this flag to `false` for error events, and only set this flag for replays and transactions, as they have the characteristic:\r\n\r\n* It is more likely to be fired right before leaving the page\r\n* It is not likely to have multiple of these requests in parallel (for replay, you only ever have one pending request)\r\n\r\nFor errors, in contrast, you can have many at the same time, and it's not so likely to have (relevant) errors right before a page is switched.\r\n\r\nThis is IMHO the best tradeoff overall.\r\n\r\n## Reproduction\r\n\r\nWe could reproduce this with the following code:\r\n\r\n```js\r\n for (let i = 0; i \u003c 60; i++) {\r\n Sentry.captureException(`test exception ${i}`);\r\n}\r\n```\r\n\r\nSome of the sentry request will remain `pending` forever in Chrome.\r\nnote that _other_ fetch requests to other domains do go through. Still, this is not ideal.\r\n\r\n## Observations\r\n\r\n* The promise buffer works at cutting requests off after 30 in flight requests (e.g. the above example only triggers 30 requests)\r\n* It seems to work to make a lot of keepalive requests to other domains, e.g.: \r\n```js\r\nfor (let i = 0; i \u003c 30; i++) {\r\n fetch(`https://reqres.in/api/users/`, { method: 'POST', keepalive: true });\r\n}\r\n```\r\n* The promise buffer detects the \"pending\" promises as failed, and successfully removes them from the buffer.\r\n* Once we run into the pending scenario, most new requests are also pending (e.g. adding 30 more will only resolve 4, and 26 are pending)\r\n\r\n","author":{"url":"https://github.com/mydea","@type":"Person","name":"mydea"},"datePublished":"2023-03-21T09:40:52Z","url":"https://github.com/getsentry/sentry-javascript/issues/7546"}
| 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:a10ed3c3-1b02-ee5f-f0a9-b2491213a58e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8EC6:2FACC4:616B02:888838:6B0449C4 |
| html-safe-nonce | 83f11cc8f3eedd5246f47a3c49060bf6e115e37a9056f637ffefdd9b4a19ff4a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RUM2OjJGQUNDNDo2MTZCMDI6ODg4ODM4OjZCMDQ0OUM0IiwidmlzaXRvcl9pZCI6IjgxNjE3ODU0NzAzMTQxMDUyODQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 67f31ae6236b55dae4f4da7850cc04bd2f7da1eed693684f24690fef3715bcc0 |
| hovercard-subject-tag | issue:1633534287 |
| 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/7546/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ecaf0ba69e95560a43814f70cbda6f868b9638d74ff9b58c0ad210ac672b03d7/getsentry/sentry-javascript/issues/7546 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ecaf0ba69e95560a43814f70cbda6f868b9638d74ff9b58c0ad210ac672b03d7/getsentry/sentry-javascript/issues/7546 |
| og:image:alt | We have introduced keepalive in #5697. However, there have been some reports (e.g. #6049) that users have pending HTTP requests, probably due to this. We should set this flag to false for error eve... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mydea |
| hostname | github.com |
| expected-hostname | github.com |
| None | d4495c3631faba668036f176d1f5946901c5172efd73a6edb984029e7d4f8e46 |
| 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 | 9ac4337fb7c6a5846cdfdb1a04f154d3c33ebc77 |
| 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