Skip to content

quic: fix abort on handshake failure in connect() - #67617

Open
christianaurichzm wants to merge 1 commit into
nodejs:mainfrom
christianaurichzm:quic-connect-first-flight-abort
Open

christianaurichzm wants to merge 1 commit into
nodejs:mainfrom
christianaurichzm:quic-connect-first-flight-abort

Conversation

@christianaurichzm

Copy link
Copy Markdown
Member

quic.connect() aborts the process when the handshake fails before connect() returns, for example with an empty cipher list:

$ node --experimental-quic -e "require('node:quic').connect('127.0.0.1:1', { alpn: 'x', ciphers: '' })"
  #  node[1043888]: void node::quic::Session::EmitClose(const node::quic::QuicError&) at ../src/quic/session.cc:4057
  #  Assertion failed: is_destroyed()

Endpoint::Connect() marks the session as wrapped and only then sends the first flight. If the session closes during that send, the close is emitted to JavaScript before the QuicSession exists, and nothing calls destroy(). groups: '' and handshakeTimeout: 0 hit the same path. This sends the first flight before marking the session as wrapped, so connect() rejects with ERR_QUIC_CONNECTION_FAILED instead.

Endpoint::Connect() marked the session as wrapped before sending the
first flight, while JavaScript had no QuicSession for it yet. If the
session closed during that send, for example with ciphers: '', nothing
called destroy() and the CHECK in Session::EmitClose() aborted the
process. Send the first flight before marking the session as wrapped,
so connect() rejects with ERR_QUIC_CONNECTION_FAILED instead.

Signed-off-by: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/quic

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. quic Issues and PRs related to the QUIC transport implementation. labels Nov 19, 2026
@codecov

codecov Bot commented Nov 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.71%. Comparing base (d9e18d5) to head (a59007a).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67617      +/-   ##
==========================================
- Coverage   90.72%   90.71%   -0.02%     
==========================================
  Files         801      801              
  Lines      280809   280809              
  Branches    54212    54211       -1     
==========================================
- Hits       254776   254745      -31     
- Misses      16209    16248      +39     
+ Partials     9824     9816       -8     

see 32 files with indirect coverage changes

🚀 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.

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

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. quic Issues and PRs related to the QUIC transport implementation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants