Skip to content

Conversation

@mar-cf
Copy link
Contributor

@mar-cf mar-cf commented Dec 16, 2025

The span attached to a subrequest is held by the fetch promise, which can be passed to waitUntilTasks. When an actor aborts while another request's waitUntil task is still pending, span duration may be incorrect. Span reporting relies on timing from the current request.

If there are reasons not to reorder ~IncomingRequest to cancel pending operations before removing from the list, we can reconsider the assumption that an active request is available during that time.

@mar-cf mar-cf requested review from a team as code owners December 16, 2025 22:48
@mar-cf
Copy link
Contributor Author

mar-cf commented Dec 16, 2025

Tests build on tests added in another change, so ignore the base until that's merged.

@mar-cf mar-cf requested a review from fhanau December 16, 2025 23:02
@mar-cf
Copy link
Contributor Author

mar-cf commented Dec 16, 2025

cc @kentonv I see you added this originally, so I plan to request your review after I get some buy in from Felix.

@mar-cf mar-cf force-pushed the mar/stw-span-without-request branch from ba5bbd0 to fbe364b Compare December 16, 2025 23:44
@fhanau
Copy link
Contributor

fhanau commented Dec 18, 2025

The span attached to a subrequest is held by the fetch promise, which can be passed to waitUntilTasks. When an actor aborts while another request's waitUntil task is still pending, span reporting can partially fail. Span reporting relies on timing from the current request.

The description is misleading here – span reporting doesn't "partially fail", we merely fall back to the return event timestamp as the IncomingRequest was removed prematurely. The span metadata will still be reported in full, only the timestamp may be off.

Copy link
Contributor

@fhanau fhanau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lines up with what I had in mind for this issue as described in #5282 (comment) – it should solve the issue at hand but I can't rule out that reordering actions in ~IoContext_IncomingRequest would cause other issues, maybe there was a reason for having the current order, which looks less intuitive than the one being proposed here.

Base automatically changed from mar/stw-alarm to main December 18, 2025 21:53
mar-cf and others added 2 commits December 18, 2025 15:55
The span attached to a subrequest is held by the fetch promise, which can be passed to waitUntilTasks. When an actor aborts while another request's waitUntil task is still pending, span reporting can partially fail. Span reporting relies on timing from the current request.

If there are reasons not to reorder ~IncomingRequest to cancel pending operations before removing from the list, we can reconsider the assumption that an active request is available during that time.
Co-authored-by: Dan Lapid <dlapid@cloudflare.com>
@mar-cf
Copy link
Contributor Author

mar-cf commented Dec 18, 2025

The span attached to a subrequest is held by the fetch promise, which can be passed to waitUntilTasks. When an actor aborts while another request's waitUntil task is still pending, span reporting can partially fail. Span reporting relies on timing from the current request.

The description is misleading here – span reporting doesn't "partially fail", we merely fall back to the return event timestamp as the IncomingRequest was removed prematurely. The span metadata will still be reported in full, only the timestamp may be off.

Updated desc.

@mar-cf mar-cf force-pushed the mar/stw-span-without-request branch from fbe364b to 5a7b8eb Compare December 18, 2025 21:59
@mar-cf mar-cf requested a review from kentonv December 18, 2025 22:05
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 18, 2025

CodSpeed Performance Report

Merging #5709 will degrade performances by 8.86%

Comparing mar/stw-span-without-request (5a7b8eb) with main (117eda7)

Summary

❌ 1 regression
✅ 56 untouched
⏩ 34 skipped1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
simpleStringBody[Response] 19.6 µs 21.5 µs -8.86%

Footnotes

  1. 34 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants