Title: Abort "Lazy deopt after a fast API call with return value is unsupported" in Buffer.byteLength called from maybePrepareFinalChunk / res.end(string) · Issue #66870 · nodejs/node · GitHub
Open Graph Title: Abort "Lazy deopt after a fast API call with return value is unsupported" in Buffer.byteLength called from maybePrepareFinalChunk / res.end(string) · Issue #66870 · nodejs/node
X Title: Abort "Lazy deopt after a fast API call with return value is unsupported" in Buffer.byteLength called from maybePrepareFinalChunk / res.end(string) · Issue #66870 · nodejs/node
Description: Version v26.10.0 (node-26.10.0-linux-x64 from actions/setup-node@v5). The same abort also occurred on 2026-08-28 in a second CI run on the then-current 26.x build, so it is not a one-off. Platform Linux 6.x x64 (GitHub Actions ubuntu-lat...
Open Graph Description: Version v26.10.0 (node-26.10.0-linux-x64 from actions/setup-node@v5). The same abort also occurred on 2026-08-28 in a second CI run on the then-current 26.x build, so it is not a one-off. Platform ...
X Description: Version v26.10.0 (node-26.10.0-linux-x64 from actions/setup-node@v5). The same abort also occurred on 2026-08-28 in a second CI run on the then-current 26.x build, so it is not a one-off. Platform ...
Opengraph URL: https://github.com/nodejs/node/issues/66870
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Abort \"Lazy deopt after a fast API call with return value is unsupported\" in Buffer.byteLength called from maybePrepareFinalChunk / res.end(string)","articleBody":"### Version\r\n\r\n`v26.10.0` (`node-26.10.0-linux-x64` from `actions/setup-node@v5`).\r\n\r\nThe same abort also occurred on 2026-08-28 in a second CI run on the then-current 26.x build, so it is not a one-off.\r\n\r\n### Platform\r\n\r\n```text\r\nLinux 6.x x64 (GitHub Actions ubuntu-latest runner)\r\n```\r\n\r\nAll local attempts to reproduce on Windows 11 x64 with `v26.10.0` and `v26.12.0` failed (details below).\r\n\r\n### Subsystem\r\n\r\n`http` / `buffer` (V8 fast API call inside `Buffer.byteLength`, reached from `_http_outgoing`).\r\n\r\n### What steps will reproduce the bug?\r\n\r\nThere is no standalone minimal repro yet - this is the report of a real production abort with a complete V8 stack. The reproducing workload is a Vite dev server under sustained browser traffic:\r\n\r\n1. Run `vite` (8.3.4) on Linux with Node 26.10.0.\r\n2. Load a page that pulls a large pre-bundled dependency chunk. In this case `node_modules/.vite/deps/lib-*.js` is 17,416,067 bytes; Vite's `send` helper appends an inline source map, producing a `String[43640789]`.\r\n3. Drive continuous Playwright traffic for roughly ten minutes (261 browser tests hitting the dev server).\r\n4. The dev-server process aborts and every later connection fails with `net::ERR_CONNECTION_REFUSED`.\r\n\r\nThe abort itself:\r\n\r\n```text\r\nabort: Lazy deopt after a fast API call with return value is unsupported\r\n\r\n==== JS stack trace =========================================\r\n\r\n 0: ExitFrame [pc: 0x7f49dce3ea76]\r\n 1: byteLength [0x3fc66a4d8b91] [node:buffer:923] [bytecode=0xe4e3e6b3dc1 offset=88](this=0x3fc66a4d72e1 \u003cJSFunction Buffer (sfi = 0x385470d41a39)>#0#,0x3ba819d309a1 \u003cString[43640789]: uc\"...\u003ctruncated>>\">#1#,0x36331f5c0011 \u003cundefined>)\r\n 2: maybePrepareFinalChunk(aka maybePrepareFinalChunk) [0x67fc7c1ba61] [node:_http_outgoing:1069] [bytecode=0x1de7ebdcd5d1 offset=58](this=0x36331f5c0011 \u003cundefined>,0x3ba819d357d9 \u003cServerResponse map = 0x25850d03f771>#2#,0x3ba819d309a1 \u003cString[43640789]: uc\"...\u003ctruncated>>\">#1#,0x36331f5c0011 \u003cundefined>)\r\n 3: end [0x67fc7c1e8b9] [node:_http_outgoing:1197] [bytecode=0x1de7ebdcd0b1 offset=117](this=0x3ba819d357d9 \u003cServerResponse map = 0x25850d03f771>#2#,0x3ba819d309a1 \u003cString[43640789]: uc\"...\u003ctruncated>>\">#1#,0x36331f5c0011 \u003cundefined>,0x36331f5c0011 \u003cundefined>)\r\n 4: send$1(aka send$1) [0x1b9f12a631e9] [file:///home/runner/work/\u003crepo>/node_modules/vite/dist/node/chunks/node.js:~17519] [pc=0x7f49bd3567a7](...)\r\n 5: viteTransformMiddleware [file:///home/runner/work/\u003crepo>/node_modules/vite/dist/node/chunks/node.js:~20159]\r\n```\r\n\r\nFrame 1 is Node's own `Buffer.byteLength` (`node:buffer:923`) and frame 2 is Node's `maybePrepareFinalChunk` (`node:_http_outgoing:1069`), whose source is captured in the report:\r\n\r\n```js\r\nfunction maybePrepareFinalChunk(msg, chunk, encoding) {\r\n if (typeof chunk !== 'string' && !isUint8Array(chunk))\r\n return false;\r\n\r\n if (msg.destroyed || msg.strictContentLength)\r\n return false;\r\n\r\n if (!msg._header) {\r\n msg._contentLength = typeof chunk === 'string' ?\r\n Buffer.byteLength(chunk, encoding) : chunk.byteLength\r\n```\r\n\r\nSo the aborting path is `res.end(string)` with `msg._header` unset, which calls `Buffer.byteLength(hugeString, undefined)`.\r\n\r\n### How often does it reproduce? Is there a required condition?\r\n\r\nTwice in two CI runs on Linux x64, roughly ten minutes into sustained dev-server traffic. It did not reproduce in short bursts.\r\n\r\nI could not reproduce it locally on Windows 11 x64, with either `v26.10.0` or `v26.12.0`, using:\r\n\r\n- 300 sequential `res.end()` responses of a 43.6 MB string;\r\n- 3,000 responses of a 1 MB string alternating with a `Buffer` and with `res.end(string, 'utf8')` to vary the call site;\r\n- 2,800 requests for the real 43.8 MB Vite dev-server chunk (the same `send` path as the crash) over keep-alive sockets;\r\n- the same runs with `--deopt-every-n-times=3` to force deopts at deopt points.\r\n\r\nSo the trigger appears to need more than \"a large string through `res.end`\" - possibly the specific optimized-code state of the Vite middleware chain on the CI runner, or a longer warm-up than a few thousand requests.\r\n\r\n### What is the expected behavior? Why is that the expected behavior?\r\n\r\nServing a large string with `res.end()` should never abort the process. Payload size and repetition may cost memory and CPU, but a correct runtime either deoptimizes or keeps the optimized code; it does not terminate.\r\n\r\n### What do you see instead?\r\n\r\nThe process aborts with `Lazy deopt after a fast API call with return value is unsupported`, killing the server mid-suite.\r\n\r\n### Additional information\r\n\r\nThe fatal string is a V8 bailout reason, `v8/src/codegen/bailout-reason.h`:\r\n\r\n```text\r\n\"Lazy deopt after a fast API call with return value is unsupported\"\r\n```\r\n\r\nand `Buffer.byteLength` is exactly a fast API call with a return value, per `src/node_buffer.cc`:\r\n\r\n```cpp\r\nuint32_t FastByteLengthUtf8(...) {\r\nTRACK_V8_FAST_API_CALL(\"Buffer::FastByteLengthUtf8\");\r\nstatic CFunction fast_byte_length_utf8(CFunction::Make(FastByteLengthUtf8));\r\n```\r\n\r\nThe corresponding V8 work item is \"Add deopt support after fast api calls with return values\" (https://issues.chromium.org/issues/418936518), so this may be a V8 limitation that Node surfaces. Filing here because the aborting frame is Node's `_http_outgoing` code and the call is Node's own `Buffer.byteLength`, and because the practical fix may be on the Node side.\r\n\r\nOur workaround, in case it is useful for triage, is to make the caller hand Node bytes so the fast API is not on the path (`res.end(Buffer.from(content))` instead of `res.end(content)`); with that in place the dev server survives the same workload.\r\n\r\nIf a standalone reproduction is required before this is actionable, I am happy to run a loop on a Linux runner against a candidate commit - please say which shape you want (for example a `node:test` server plus a client loop, or a V8 `d8` snippet) and I will provide it.\r\n","author":{"url":"https://github.com/jakesalvesen","@type":"Person","name":"jakesalvesen"},"datePublished":"2026-10-20T05:31:06Z","url":"https://github.com/nodejs/node/issues/66870"}
| 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:cac79db6-0fbb-f247-1d70-b83cdb58ce7b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C54C:1CF1FE:4E329:6B7E4:6AFBF536 |
| html-safe-nonce | 016437e6405efd2229429d5665e3f246832bca27b91490236564db223958d511 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNTRDOjFDRjFGRTo0RTMyOTo2QjdFNDo2QUZCRjUzNiIsInZpc2l0b3JfaWQiOiI2NzUzMTcwMzcyMDAzODg2MzkwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 5b8e7d6aa0fc8e082ae2a84539f5507186f4b06dffe18be4a12c266280975e85 |
| hovercard-subject-tag | issue:5936486191 |
| 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/nodejs/node/66870/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0aedd69fc9effaebcd56d405bcb45fc2b656bc0b3ddd82558d140d45142a3292/nodejs/node/issues/66870 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0aedd69fc9effaebcd56d405bcb45fc2b656bc0b3ddd82558d140d45142a3292/nodejs/node/issues/66870 |
| og:image:alt | Version v26.10.0 (node-26.10.0-linux-x64 from actions/setup-node@v5). The same abort also occurred on 2026-08-28 in a second CI run on the then-current 26.x build, so it is not a one-off. Platform ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jakesalvesen |
| hostname | github.com |
| expected-hostname | github.com |
| None | fa74413a1d84dac536fcca0740780bcbd3207bafec0e51873b73ff8e8cca032f |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| 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 | b3b5633a74535d9c23385512d534c66c8fde1907 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width