镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

v15.x regression - ERR_INTERNAL_ASSERTION - failed assert(socket._httpMessage === this); #35833

Description

@kaizhu256
  • Version: 15.0.0, 15.0.1
  • Platform: linux, windows
  • Subsystem: x64

What steps will reproduce the bug?

  1. install any node v15.0.x on windows or linux

  2. copy-paste the following in shell (or git-bash for windows):

#!/bin/sh
node -e '
/*jslint node*/
"use strict";
require("http").createServer(function (ignore, res) {
    res.on("error", function () {
        return;
    });
    res.end("cc");
    res.end("dd");
}).listen(8081, function () {
    require("http").request("http://localhost:8081").end();
});
'

# stderr
#
# node:internal/assert:14
#     throw new ERR_INTERNAL_ASSERTION(message);
#     ^
#
# Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
# Please open an issue with this stack trace at https://github.com/nodejs/node/issues
#
#     at new NodeError (node:internal/errors:258:15)
#     at assert (node:internal/assert:14:11)
#     at ServerResponse.detachSocket (node:_http_server:239:3)
#     at resOnFinish (node:_http_server:799:7)
#     at ServerResponse.emit (node:events:327:20)
#     at onFinish (node:_http_outgoing:794:10)
#     at afterWrite (node:internal/streams/writable:496:5)
#     at afterWriteTick (node:internal/streams/writable:483:10)
#     at processTicksAndRejections (node:internal/process/task_queues:79:21) {
#   code: 'ERR_INTERNAL_ASSERTION'
# }

How often does it reproduce? Is there a required condition?

  • reproducible everytime.
  • conditions:
  1. ServerResponse must have listener on error event
  2. ServerResponse.prototype.end(...) must be called more than once with non-empty payload

What is the expected behavior?

there should be no ERR_INTERNAL_ASSERTION raised

What do you see instead?

ERR_INTERNAL_ASSERTION raised

Additional information

ERR_INTERNAL_ASSERTION raised at https://github.com/nodejs/node/blob/v15.0.1/lib/_http_server.js#L239

ServerResponse.prototype.detachSocket = function detachSocket(socket) {
  assert(socket._httpMessage === this); // failed assertion
  socket.removeListener('close', onServerResponseClose);
  socket._httpMessage = null;
  this.socket = null;
};

Activity

  1. changed the title [-]ERR_INTERNAL_ASSERTION - failed `assert(socket._httpMessage === this);`[/-] [+]v15.x regression - ERR_INTERNAL_ASSERTION - failed `assert(socket._httpMessage === this);`[/+] on Oct 27, 2020
  2. Flarna commented on Oct 27, 2020

    @Flarna
    Member

    @ronag I think this is caused by #31818

  3. added
    httpIssues and PRs related to the http subsystem.
    on Oct 28, 2020
  4. rickyes commented on Oct 28, 2020

    @rickyes
    Contributor

    Since after calling .end again with the payload, it did not return in time, causing .onFinish to be called again to trigger the assertion failure, i will fix it.

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.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions