Skip to content

http: request.abort() does not destroy the socket when using a Unix Domain Socket #10812

Closed
@lpinca

Description

@lpinca
  • Version: v7.4.0
  • Platform: Linux
  • Subsystem: http

When using a Unix Domain Socket, request.abort() does not destroy the socket if abort() is called before a socket is assigned to the request.

Here is a test case:

'use strict';

const http = require('http');

const socketPath = `/tmp/test_socket_${Date.now()}`;

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/plain');
  res.end('Hello World');
});

server.listen(socketPath, () => {
  const req = http.get({ socketPath });

  req.on('error', () => {});
  req.abort();

  setTimeout(() => server.close(), 100);
});

The process should exit after the timeout, but it doesn't. If abort() is called when the socket is assigned to the request, everything work as expected.

From a quick look it seems that the free event is emitted on the socket, but nothing happens after that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    httpIssues or 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