Skip to content

Add changelog entry for streaming deadlock fix (#2562)#2564

Merged
AbanoubGhadban merged 2 commits intomasterfrom
changelog-pr-2562
Mar 8, 2026
Merged

Add changelog entry for streaming deadlock fix (#2562)#2564
AbanoubGhadban merged 2 commits intomasterfrom
changelog-pr-2562

Conversation

@AbanoubGhadban
Copy link
Copy Markdown
Collaborator

@AbanoubGhadban AbanoubGhadban commented Mar 8, 2026

Summary

Test plan

  • Verify changelog formatting matches existing entries

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed streaming deadlocks, masked exceptions, and cache poisoning when clients disconnect.
    • Improved error handling for dev-server bundle and asset fetching to surface HTTP errors reliably.
    • Resolved server-side streaming hangs and silent error absorption during payload injection, plus safety improvements for request termination.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 72d56e1d-013c-45bb-bd04-9afe44dd562f

📥 Commits

Reviewing files that changed from the base of the PR and between 35a76e3 and d97daee.

📒 Files selected for processing (1)
  • CHANGELOG.md

Walkthrough

Three Pro-specific fixes were added to the CHANGELOG under Unreleased: fixes for streaming deadlocks and async exception/cache issues on client disconnect, handling HTTPX error responses when fetching dev-server bundles/assets, and streaming SSR hang fixes with safePipe and termination signaling.

Changes

Cohort / File(s) Summary
Changelog Documentation
CHANGELOG.md
Added three Unreleased "Fixed" entries: (1) fixed streaming deadlock, exception masking, and cache poisoning on client disconnect; (2) surface HTTPX error responses when fetching dev-server bundles/assets to avoid body-access races; (3) fixed streaming SSR hangs and silent error absorption by introducing safePipe and termination signals (plus Ruby request-hang safety).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 I nibbled bugs from streaming threads,

caught HTTPX echoes in their heads,
poked at pipes until they sleep no more,
and tucked SSR hangs out the door—
now changelogs sing and systems hop galore! 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a changelog entry documenting streaming deadlock and related fixes, with clear reference to the associated issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch changelog-pr-2562

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Mar 8, 2026

Greptile Summary

This PR adds a single changelog entry for PR #2562 under the #### Pro > ##### Fixed section of the unreleased changelog, documenting four async streaming bug fixes related to client disconnect handling.

  • The new entry is correctly placed at the top of the #### Pro > ##### Fixed section within [Unreleased].
  • The entry format (bold title, description, numbered sub-points, PR link, and author attribution) is consistent with all other entries in the file.
  • No code changes are introduced — this is a documentation-only update.

Confidence Score: 5/5

  • Documentation-only change with no code impact; safe to merge.
  • This is a documentation-only change limited to adding a single changelog entry. The formatting matches existing entries, the placement is correct (top of the #### Pro > ##### Fixed section under [Unreleased]), and the PR reference points to the correct issue (Fix streaming deadlock, exception masking, and cache poisoning #2562). No code or configuration is modified.
  • No files require special attention

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Client disconnects mid-stream] --> B{Bounded queue full?}
    B -- Yes --> C[writing_task deadlock\n❌ Before fix]
    B -- Yes --> D[ensure block stops barrier\n✅ After fix]
    A --> E[Partial result cached?\n❌ Before fix]
    A --> F[on_complete gated on full consumption\nprocess_stream_chunks returns boolean\n✅ After fix]
    A --> G[Exception masked in cleanup\n❌ Before fix]
    A --> H[$ERROR_INFO captured before ensure\n✅ After fix]
    A --> I[Async::Queue::ClosedError unrescued\n❌ Before fix]
    A --> J[ClosedError rescued in cache-hit\nenqueue path\n✅ After fix]
Loading

Last reviewed commit: 35a76e3

Comment thread CHANGELOG.md Outdated

##### Fixed

- **Fix streaming deadlock, exception masking, and cache poisoning on client disconnect**: Fixed four async streaming bugs: (1) writing_task no longer deadlocks when the client disconnects mid-stream with a full bounded queue — an `ensure` block now stops the barrier on any writer exit; (2) exception masking is prevented by capturing `$ERROR_INFO` before cleanup in the ensure block; (3) cache poisoning from partial stream results is prevented by gating `on_complete` on full consumption (`process_stream_chunks` returns a boolean); (4) `Async::Queue::ClosedError` is now rescued in the cache-hit enqueue path. Also fixes Redis thread leaks in the dummy app controller. Includes integration tests for client disconnect at small, medium, and large response sizes. [PR 2562](https://github.com/shakacode/react_on_rails/pull/2562) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
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.

Two minor nits on this entry:

  1. writing_task should be backtick-formatted — all other code identifiers in this entry use backticks (`ensure`, `$ERROR_INFO`, `process_stream_chunks`, `Async::Queue::ClosedError`), but writing_task is left as plain text.

  2. Test mention should be omitted — Per the changelog guidelines ([.claude/docs/changelog-guidelines.md]): "Do NOT add entries for: linting, formatting, refactoring, tests, or documentation fixes." The sentence "Includes integration tests for client disconnect at small, medium, and large response sizes." describes a test addition, not a user-visible change, and should be dropped.

Suggested replacement:

Suggested change
- **Fix streaming deadlock, exception masking, and cache poisoning on client disconnect**: Fixed four async streaming bugs: (1) writing_task no longer deadlocks when the client disconnects mid-stream with a full bounded queue — an `ensure` block now stops the barrier on any writer exit; (2) exception masking is prevented by capturing `$ERROR_INFO` before cleanup in the ensure block; (3) cache poisoning from partial stream results is prevented by gating `on_complete` on full consumption (`process_stream_chunks` returns a boolean); (4) `Async::Queue::ClosedError` is now rescued in the cache-hit enqueue path. Also fixes Redis thread leaks in the dummy app controller. Includes integration tests for client disconnect at small, medium, and large response sizes. [PR 2562](https://github.com/shakacode/react_on_rails/pull/2562) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
- **Fix streaming deadlock, exception masking, and cache poisoning on client disconnect**: Fixed four async streaming bugs: (1) `writing_task` no longer deadlocks when the client disconnects mid-stream with a full bounded queue — an `ensure` block now stops the barrier on any writer exit; (2) exception masking is prevented by capturing `$ERROR_INFO` before cleanup in the ensure block; (3) cache poisoning from partial stream results is prevented by gating `on_complete` on full consumption (`process_stream_chunks` returns a boolean); (4) `Async::Queue::ClosedError` is now rescued in the cache-hit enqueue path. Also fixes Redis thread leaks in the dummy app controller. [PR 2562](https://github.com/shakacode/react_on_rails/pull/2562) by [AbanoubGhadban](https://github.com/AbanoubGhadban).

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Mar 8, 2026

Review: Changelog entry for PR #2562

Overall the placement and format are correct — the entry is properly under #### Pro > ##### Fixed in [Unreleased], uses the required [PR 2562](...) by [author](...) attribution format, and the bold title matches the project style.

Two minor issues flagged inline:

  1. Missing backticks on writing_task — all other code identifiers in the entry are backtick-formatted, this one is not.
  2. Test mention in changelog — the sentence describing integration test coverage should be removed per the project's changelog guidelines ("Do NOT add entries for tests").

A code suggestion with both fixes is on the inline comment.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@CHANGELOG.md`:
- Line 42: The changelog contains a duplicate entry for PR 2407 ("Fix streaming
SSR hangs and silent error absorption in RSC payload injection") in the
Unreleased section; remove this duplicate paragraph so the fix only appears
under the 16.4.0.rc.6 release. Locate the paragraph matching PR 2407 / the exact
text about safePipe and Ruby safety net in the Unreleased section and delete it
entirely, leaving the original entry under the 16.4.0.rc.6 release intact and
ensuring PR `#2562`'s intended changelog entry remains as-is.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 47160556-a682-406b-bcb9-49a32e82f9dd

📥 Commits

Reviewing files that changed from the base of the PR and between a02a4a9 and 35a76e3.

📒 Files selected for processing (1)
  • CHANGELOG.md

Comment thread CHANGELOG.md
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Mar 8, 2026

Review: Changelog Entry for PR #2562

This is a clean, correctly-formatted entry placed in the right section. A couple of observations:

1. Missing fourth bug fix

PR #2562 fixed four distinct bugs, but the entry only covers three:

  • Client disconnect deadlock - covered
  • Exception masking in ensure block - covered
  • Cache poisoning from partial chunks - covered
  • NOT mentioned: Unhandled Async::Queue::ClosedError in cache-hit path — handle_stream_cache_hit could raise ClosedError when enqueueing cached chunks to a queue closed by an error in another component.

2. Less technical detail than surrounding entries

Other entries in the same section describe the specific fix mechanism (e.g., PR 2407 mentions safePipe, close events, the Ruby safety net). This entry only says "fixed async streaming bugs" without describing what changed. Not a blocker, but worth noting for consistency.

Suggested revision:

Fix streaming deadlock, exception masking, cache poisoning, and ClosedError on client disconnect: Fixed four async streaming bugs in drain_streams_concurrently/consumer_stream_async: (1) added ensure block calling @async_barrier.stop on writing-task exit so producers cannot block forever on a full queue; (2) captured $ERROR_INFO before cleanup so a secondary writer exception does not mask the root-cause producer exception; (3) changed break to return false in process_stream_chunks and gated on_complete on full stream consumption to prevent caching incomplete HTML; (4) rescued Async::Queue::ClosedError in handle_stream_cache_hit to avoid an unhandled error when enqueuing to an already-closed queue. PR 2562 by AbanoubGhadban.

Comment thread CHANGELOG.md

##### Fixed

- **Fix streaming deadlock, exception masking, and cache poisoning on client disconnect**: Fixed async streaming bugs where client disconnect could cause deadlocks, mask producer exceptions, or cache partial results. [PR 2562](https://github.com/shakacode/react_on_rails/pull/2562) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
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.

The title and description omit one of the four fixes from PR #2562: the Async::Queue::ClosedError rescue added to handle_stream_cache_hit. That fix prevents an unhandled error when a background reader tries to enqueue a cached chunk to a queue that was already closed due to an error in another component.

Also, compared to the neighbouring entries, this description is quite terse — it doesn't mention what was done (e.g. ensure + @async_barrier.stop, return false vs break, gating on_complete). Consider expanding slightly so readers understand the shape of the fix without having to open the PR.

@AbanoubGhadban AbanoubGhadban merged commit 76018a9 into master Mar 8, 2026
12 checks passed
@AbanoubGhadban AbanoubGhadban deleted the changelog-pr-2562 branch March 8, 2026 14:24
justin808 added a commit that referenced this pull request Mar 9, 2026
## Summary

- Add changelog entries for 6 user-visible PRs merged since v16.4.0.rc.6
that were missing from `[Unreleased]`
- Update existing #2561 entry to include #2568 contributor credit

### New entries added

| Section | PR | Description |
|---|---|---|
| Added | #2539 | Environment-variable-driven ports in Procfile
templates |
| Fixed | #2417 | Rspack generator config path fix |
| Fixed | #2419 | Precompile hook load-based execution fix |
| Fixed | #2577 | `create-react-on-rails-app` validation improvements |
| Pro Fixed | #2416 | StreamResponse status fallback fix |
| Pro Fixed | #2566 | Empty-string license plan mismatch fix |

### Skipped PRs (not user-visible)

Docs (#2406, #2414, #2479, #2494, #2518, #2537, #2544), CI/internal
(#2533, #2547, #2555, #2557, #2558, #2564), dependabot (#2387, #2541),
dev dependencies (#2559, #2569, #2573).

## Test plan

- [ ] Verify changelog formatting matches existing entries
- [ ] Verify all user-visible PRs since v16.4.0.rc.6 are covered

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Documentation-only changelog updates with no runtime or build behavior
changes.
> 
> **Overview**
> Updates `CHANGELOG.md`’s **[Unreleased]** section to include
previously missing user-facing entries: Procfile templates now support
env-driven ports, several generator/`bin/dev` precompile-hook and
rspack-path fixes are documented, and `create-react-on-rails-app`
validation improvements are noted.
> 
> Also adds two Pro fix entries (StreamResponse status fallback and
license plan empty-string validation) and updates the existing `bin/dev`
precompile-hook entry to credit an additional PR/contributor.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
e75d2b5. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: Claude Opus 4.6 <[email protected]>
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.

1 participant