Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
lpinca opened this issue Jan 14, 2017 · 0 comments · Fixed by #10818
Closed

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

lpinca opened this issue Jan 14, 2017 · 0 comments · Fixed by #10818
Labels
http Issues or PRs related to the http subsystem.

Comments

@lpinca
Copy link
Member

lpinca commented Jan 14, 2017

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

@mscdex mscdex added the http Issues or PRs related to the http subsystem. label Jan 14, 2017
lpinca added a commit to lpinca/node that referenced this issue Jan 28, 2017
`request.abort()` did not destroy the socket if it was called
before a socket was assigned to the request and the request
did not use an `Agent` or a Unix Domain Socket was used.

Fixes: nodejs#10812
PR-URL: nodejs#10818
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
evanlucas pushed a commit that referenced this issue Jan 31, 2017
`request.abort()` did not destroy the socket if it was called
before a socket was assigned to the request and the request
did not use an `Agent` or a Unix Domain Socket was used.

Fixes: #10812
PR-URL: #10818
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
jasnell pushed a commit that referenced this issue Mar 8, 2017
`request.abort()` did not destroy the socket if it was called
before a socket was assigned to the request and the request
did not use an `Agent` or a Unix Domain Socket was used.

Fixes: #10812
PR-URL: #10818
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
MylesBorins pushed a commit that referenced this issue Mar 9, 2017
`request.abort()` did not destroy the socket if it was called
before a socket was assigned to the request and the request
did not use an `Agent` or a Unix Domain Socket was used.

Fixes: #10812
PR-URL: #10818
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
MylesBorins pushed a commit that referenced this issue Mar 11, 2017
`request.abort()` did not destroy the socket if it was called
before a socket was assigned to the request and the request
did not use an `Agent` or a Unix Domain Socket was used.

Fixes: #10812
PR-URL: #10818
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
MylesBorins pushed a commit that referenced this issue Mar 11, 2017
`request.abort()` did not destroy the socket if it was called
before a socket was assigned to the request and the request
did not use an `Agent` or a Unix Domain Socket was used.

Fixes: #10812
PR-URL: #10818
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
abhishekumar-tyagi pushed a commit to abhishekumar-tyagi/node that referenced this issue May 5, 2024
`request.abort()` did not destroy the socket if it was called
before a socket was assigned to the request and the request
did not use an `Agent` or a Unix Domain Socket was used.

Fixes: nodejs/node#10812
PR-URL: nodejs/node#10818
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http Issues or PRs related to the http subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants