GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||
GeezerVison is showing github.com — fix: complete upgrade diagnostics lifecycle by BridgeAR · Pull Request #5761 · nodejs/undici Conversation
Member
Successful CONNECT and protocol upgrades stop before Undici marks the request complete. Diagnostics subscribers retain per-request state, and streamed request-body listeners remain attached for the lifetime of the upgraded socket. Complete accepted upgrades through the existing response-header and trailers events. Rejected and aborted upgrades retain the existing error terminal event.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@ ## main #5761 +/- ## ========================================== - Coverage 93.50% 93.50% -0.01% ========================================== Files 110 110 Lines 39072 39099 +27 ========================================== + Hits 36534 36558 +24 - Misses 2538 2541 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
e674253 to
54a89bf
Compare
Native diagnostic callbacks entered request spans into the caller's async context. The context outlived finished requests, retained downstream resources, and made later work inherit the wrong span. Keep native diagnostics for normal request lifecycles and instrument only Undici's accepted-upgrade callback, which has no terminal diagnostic event. Activate the request span only while a configured request hook runs. The request-create hot path no longer copies the async store or switches context twice. In two fresh one-million-iteration runs it improved from 43.1-43.5 ns to 10.1-10.2 ns per operation. Refs: nodejs/undici#5761
Successful CONNECT and protocol upgrades stop before Undici marks the request complete. Diagnostics subscribers retain per-request state, and streamed request-body listeners remain attached for the lifetime of the upgraded socket. Publish the existing headers and trailers lifecycle around accepted upgrades. Abort instead when the application upgrade handler throws so subscribers always receive a terminal event. Signed-off-by: Ruben Bridgewater <[email protected]>
54a89bf to
6477ac7
Compare
Native diagnostic callbacks entered request spans into the caller's async context. The context outlived finished requests, retained downstream resources, and made later work inherit the wrong span. Keep native diagnostics for normal request lifecycles and instrument only Undici's accepted-upgrade callback, which has no terminal diagnostic event. Activate the request span only while a configured request hook runs. The request-create hot path no longer copies the async store or switches context twice. In two fresh one-million-iteration runs it improved from 43.1-43.5 ns to 10.1-10.2 ns per operation. Refs: nodejs/undici#5761
Accepted upgrades run the user handler after H1 hands off its socket and H2 assigns stream cleanup. Request-level error handling replaced H1 exceptions and rethrew H2 exceptions outside their transport owners.
|
Do you need this backported to v7.x? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Native diagnostic callbacks entered request spans into the caller's async context. The context outlived finished requests, retained downstream resources, and made later work inherit the wrong span. Keep native diagnostics for normal request lifecycles and instrument only Undici's accepted-upgrade callback, which has no terminal diagnostic event. Activate the request span only while a configured request hook runs. The request-create hot path no longer copies the async store or switches context twice. In two fresh one-million-iteration runs it improved from 43.1-43.5 ns to 10.1-10.2 ns per operation. Refs: nodejs/undici#5761
|
@mcollina yes, it needs to be backported to all supported release lines. It is an issue since v4.6.0 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
* fix(undici): prevent context retention after requests Native diagnostic callbacks entered request spans into the caller's async context. The context outlived finished requests, retained downstream resources, and made later work inherit the wrong span. Keep native diagnostics for normal request lifecycles and instrument only Undici's accepted-upgrade callback, which has no terminal diagnostic event. Activate the request span only while a configured request hook runs. The request-create hot path no longer copies the async store or switches context twice. In two fresh one-million-iteration runs it improved from 43.1-43.5 ns to 10.1-10.2 ns per operation. Refs: nodejs/undici#5761 * fix(undici): gate upgrade fallback by source Released Undici versions omit terminal diagnostics for accepted upgrades, but patched and backported implementations can share those versions. Inspecting the loaded Request method avoids wrapping implementations that already publish terminal trailers. * fix(undici): finish spans after upgrade handler errors Accepted upgrade handlers can throw after Undici removes the request from its queue. Affected versions then destroy the socket without a terminal diagnostic event, which retains the span. Publish one fallback error event and rethrow the original error. Scope the hook-context assertion to native diagnostics versions so Node 26 does not format unrelated cyclic span graphs.
* fix(undici): prevent context retention after requests Native diagnostic callbacks entered request spans into the caller's async context. The context outlived finished requests, retained downstream resources, and made later work inherit the wrong span. Keep native diagnostics for normal request lifecycles and instrument only Undici's accepted-upgrade callback, which has no terminal diagnostic event. Activate the request span only while a configured request hook runs. The request-create hot path no longer copies the async store or switches context twice. In two fresh one-million-iteration runs it improved from 43.1-43.5 ns to 10.1-10.2 ns per operation. Refs: nodejs/undici#5761 * fix(undici): gate upgrade fallback by source Released Undici versions omit terminal diagnostics for accepted upgrades, but patched and backported implementations can share those versions. Inspecting the loaded Request method avoids wrapping implementations that already publish terminal trailers. * fix(undici): finish spans after upgrade handler errors Accepted upgrade handlers can throw after Undici removes the request from its queue. Affected versions then destroy the socket without a terminal diagnostic event, which retains the span. Publish one fallback error event and rethrow the original error. Scope the hook-context assertion to native diagnostics versions so Node 26 does not format unrelated cyclic span graphs.
* fix(undici): prevent context retention after requests Native diagnostic callbacks entered request spans into the caller's async context. The context outlived finished requests, retained downstream resources, and made later work inherit the wrong span. Keep native diagnostics for normal request lifecycles and instrument only Undici's accepted-upgrade callback, which has no terminal diagnostic event. Activate the request span only while a configured request hook runs. The request-create hot path no longer copies the async store or switches context twice. In two fresh one-million-iteration runs it improved from 43.1-43.5 ns to 10.1-10.2 ns per operation. Refs: nodejs/undici#5761 * fix(undici): gate upgrade fallback by source Released Undici versions omit terminal diagnostics for accepted upgrades, but patched and backported implementations can share those versions. Inspecting the loaded Request method avoids wrapping implementations that already publish terminal trailers. * fix(undici): finish spans after upgrade handler errors Accepted upgrade handlers can throw after Undici removes the request from its queue. Affected versions then destroy the socket without a terminal diagnostic event, which retains the span. Publish one fallback error event and rethrow the original error. Scope the hook-context assertion to native diagnostics versions so Node 26 does not format unrelated cyclic span graphs.
|
Can you open the backports PR then? The code would be substantially different in v7 at least. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
* fix(undici): prevent context retention after requests Native diagnostic callbacks entered request spans into the caller's async context. The context outlived finished requests, retained downstream resources, and made later work inherit the wrong span. Keep native diagnostics for normal request lifecycles and instrument only Undici's accepted-upgrade callback, which has no terminal diagnostic event. Activate the request span only while a configured request hook runs. The request-create hot path no longer copies the async store or switches context twice. In two fresh one-million-iteration runs it improved from 43.1-43.5 ns to 10.1-10.2 ns per operation. Refs: nodejs/undici#5761 * fix(undici): gate upgrade fallback by source Released Undici versions omit terminal diagnostics for accepted upgrades, but patched and backported implementations can share those versions. Inspecting the loaded Request method avoids wrapping implementations that already publish terminal trailers. * fix(undici): finish spans after upgrade handler errors Accepted upgrade handlers can throw after Undici removes the request from its queue. Affected versions then destroy the socket without a terminal diagnostic event, which retains the span. Publish one fallback error event and rethrow the original error. Scope the hook-context assertion to native diagnostics versions so Node 26 does not format unrelated cyclic span graphs.
* fix(undici): prevent context retention after requests Native diagnostic callbacks entered request spans into the caller's async context. The context outlived finished requests, retained downstream resources, and made later work inherit the wrong span. Keep native diagnostics for normal request lifecycles and instrument only Undici's accepted-upgrade callback, which has no terminal diagnostic event. Activate the request span only while a configured request hook runs. The request-create hot path no longer copies the async store or switches context twice. In two fresh one-million-iteration runs it improved from 43.1-43.5 ns to 10.1-10.2 ns per operation. Refs: nodejs/undici#5761 * fix(undici): gate upgrade fallback by source Released Undici versions omit terminal diagnostics for accepted upgrades, but patched and backported implementations can share those versions. Inspecting the loaded Request method avoids wrapping implementations that already publish terminal trailers. * fix(undici): finish spans after upgrade handler errors Accepted upgrade handlers can throw after Undici removes the request from its queue. Affected versions then destroy the socket without a terminal diagnostic event, which retains the span. Publish one fallback error event and rethrow the original error. Scope the hook-context assertion to native diagnostics versions so Node 26 does not format unrelated cyclic span graphs.
This reverts commit 95f6554.
This reverts commit 95f6554.
This reverts commit 95f6554.
This reverts commit 95f6554.
This reverts commit 95f6554.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.