Skip to content

[o11y] Avoid tail stream cancellation warning with empty handler#6560

Merged
fhanau merged 1 commit into
mainfrom
felix/041026-fix-empty-handler-error
Apr 13, 2026
Merged

[o11y] Avoid tail stream cancellation warning with empty handler#6560
fhanau merged 1 commit into
mainfrom
felix/041026-fix-empty-handler-error

Conversation

@fhanau

@fhanau fhanau commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

We were not marking the TailStreamTarget fulfiller as done if the RPC call with the outcome event did not result in any calls to the tail handler (which can happen if the tail handler is an empty object). This resulted in cumbersome "Streaming tail session canceled" warnings.

Test: When making tailStream() in src/workerd/api/tests/tail-worker-test-invalid.js return {} instead of an invalid value, we no longer get cancellation warnings.

@fhanau fhanau requested a review from mar-cf April 11, 2026 01:49
@fhanau fhanau requested review from a team as code owners April 11, 2026 01:49
@ask-bonk

ask-bonk Bot commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

The logic is sound. The fix correctly addresses the gap where doFulfill is true but returnValues is empty (no handler matched any event in the object case). The destructor at line 643-644 would reject the fulfiller with a "Streaming tail session canceled" error, which is the spurious warning the PR eliminates.

The change is minimal, correct, and well-commented. There are no backward compatibility concerns (this is fixing a spurious warning, not changing behavior), no security implications, and no API changes. The PR author notes they plan to add a regression test before merge.

LGTM

github run

@mar-cf mar-cf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's get this in, but also verify if there's setup that can be avoided with this handler.

We were not marking the TailStreamTarget fulfiller as done if the RPC call with
the outcome event did not result in any calls to the tail handler (which can
happen if the tail handler is an empty object). This resulted in cumbersome
"Streaming tail session canceled" warnings.
@fhanau fhanau force-pushed the felix/041026-fix-empty-handler-error branch from 013e9a2 to d8dfd8d Compare April 13, 2026 19:02
@fhanau

fhanau commented Apr 13, 2026

Copy link
Copy Markdown
Contributor Author

Let's get this in, but also verify if there's setup that can be avoided with this handler.

There certainly is – we could check if the given handler is empty (or more generally does not include a handler for any of the different event types). Before making that optimization, I'll implement some of the remaining functional improvements.

@codspeed-hq

codspeed-hq Bot commented Apr 13, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 12.83%

❌ 1 regressed benchmark
✅ 69 untouched benchmarks
⏩ 129 skipped benchmarks1

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

Performance Changes

Benchmark BASE HEAD Efficiency
Encode_ASCII_32[TextEncoder][0/0/32] 2.7 ms 3.1 ms -12.83%

Comparing felix/041026-fix-empty-handler-error (d8dfd8d) with main (50c021a)

Open in CodSpeed

Footnotes

  1. 129 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.

@fhanau fhanau merged commit 3555e25 into main Apr 13, 2026
22 of 23 checks passed
@fhanau fhanau deleted the felix/041026-fix-empty-handler-error branch April 13, 2026 21:11
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.

2 participants