Skip to content

Conversation

@mcollina
Copy link
Member

Summary

Fixed flaky Dispatcher#Connect test in test/http2-dispatcher.js that was intermittently failing with ERR_HTTP2_STREAM_ERROR and timing out.

Problem

The test was using response.body.pipe(stream) without proper error handling. When HTTP/2 streams encountered errors (like NGHTTP2_INTERNAL_ERROR), they became uncaught exceptions, causing random test failures and timeouts.

Solution

  • Replaced .pipe() with pipeline() for proper error handling
  • Added try-catch block around the forward request
  • Properly destroys streams on errors to prevent hanging connections

Test Plan

  • ✅ Ran test 20+ times consecutively - all passed
  • ✅ Pre-commit hooks passed (eslint)

🤖 Generated with Claude Code

Replace .pipe() with pipeline() in Dispatcher#Connect test to properly
handle stream errors and prevent uncaught exceptions. The test was
failing intermittently with ERR_HTTP2_STREAM_ERROR when streams
encountered errors during proxying.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Matteo Collina <hello@matteocollina.com>
@mcollina mcollina requested a review from Uzlopak October 20, 2025 08:34
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.86%. Comparing base (f69e47b) to head (e9ff5ce).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4633   +/-   ##
=======================================
  Coverage   92.86%   92.86%           
=======================================
  Files         106      106           
  Lines       33111    33111           
=======================================
  Hits        30747    30747           
  Misses       2364     2364           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@gurgunday gurgunday left a comment

Choose a reason for hiding this comment

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

lgtm

@metcoder95 metcoder95 merged commit 71560fe into main Oct 21, 2025
31 of 35 checks passed
@metcoder95 metcoder95 deleted the fix-http2-dispatcher-flaky-test branch October 21, 2025 06:43
metcoder95 pushed a commit that referenced this pull request Oct 30, 2025
Co-authored-by: Claude <noreply@anthropic.com>
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.

6 participants