mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 21:58:48 +02:00
async_hooks: add missing async_hooks destroys in AsyncReset
This adds missing async_hooks destroy calls for sockets (in _http_agent.js) and HTTP parsers. We need to emit a destroy in AsyncWrap#AsyncReset before assigning a new async_id when the instance has already been in use and is being recycled, because in that case, we have already emitted an init for the "old" async_id. This also removes a duplicated init call for HTTP parser: Each time a new parser was created, AsyncReset was being called via the C++ Parser class constructor (super constructor AsyncWrap) and also via Parser::Reinitialize. PR-URL: https://github.com/nodejs/node/pull/23272 Fixes: https://github.com/nodejs/node/issues/19859 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
45c70b0ce7
commit
eb9748d222
16 changed files with 206 additions and 37 deletions
|
@ -98,7 +98,7 @@ function expectBody(expected) {
|
|||
throw new Error('hello world');
|
||||
};
|
||||
|
||||
parser.reinitialize(HTTPParser.REQUEST);
|
||||
parser.reinitialize(HTTPParser.REQUEST, false);
|
||||
|
||||
assert.throws(
|
||||
() => { parser.execute(request, 0, request.length); },
|
||||
|
@ -558,7 +558,7 @@ function expectBody(expected) {
|
|||
parser[kOnBody] = expectBody('ping');
|
||||
parser.execute(req1, 0, req1.length);
|
||||
|
||||
parser.reinitialize(REQUEST);
|
||||
parser.reinitialize(REQUEST, false);
|
||||
parser[kOnBody] = expectBody('pong');
|
||||
parser[kOnHeadersComplete] = onHeadersComplete2;
|
||||
parser.execute(req2, 0, req2.length);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue