Skip to content

http: OutgoingMessage ERR_STREAM_DESTROYED callback #36673

Description

@ronag

OutgoingMessage should invoke the callback for _writeRaw with ERR_STREAM_DESTROYED when the it's already been destroyed.

Refs: #29227 (comment)

Activity

  1. added
    httpIssues and PRs related to the http subsystem.
    streamIssues and PRs related to Node.js streams.
    on Dec 29, 2020
  2. trivikr commented on May 20, 2026

    @trivikr
    Member

    Tested with node 26.1.0

    Minimal repro

    import http from 'node:http';
    
    const msg = new http.OutgoingMessage();
    msg.destroy();
    
    const result = await Promise.race([
      new Promise((resolve) => {
        msg._writeRaw('data', (err) => resolve(err?.code ?? 'no error'));
      }),
      new Promise((resolve) => setTimeout(() => resolve('callback not called'), 100)),
    ]);
    
    console.log(result);

    Observed

    callback not called

    This is because _writeRaw() returns after destruction without invoking the callback

    Expected

    ERR_STREAM_DESTROYED

    This should match stream write callback behavior for already-destroyed streams.

  3. github-actions commented on Aug 19, 2026

    @github-actions
    Contributor

    This issue has been marked as stale due to 90 days of inactivity.
    It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.

  4. added
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Aug 19, 2026
  5. github-actions commented on Sep 19, 2026

    @github-actions
    Contributor

    This issue has been automatically closed after 30 days of inactivity following its stale status (no activity for a total of 120 days).
    If this is still relevant, feel free to reopen it or leave a comment with additional details so we can continue the discussion.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    httpIssues and PRs related to the http subsystem.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.streamIssues and PRs related to Node.js streams.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions