Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
Closed
Labels
async_hooksIssues and PRs related to the async hooks subsystem.Issues and PRs related to the async hooks subsystem.confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.
Description
- Version: 12.0.0-pre (current master)
- Platform: Darwin LIB-0F7FVH8-LT 18.2.0 Darwin Kernel Version 18.2.0: Thu Dec 20 20:46:53 PST 2018; root:xnu-4903.241.1~1/RELEASE_X86_64 x86_64
- Subsystem: async_hooks
This code shows destroy emitting twice for a single asyncId. (You may need to run it more than once to see the error and/or increase the value of N in the code, but it repros most of the time for me.)
'use strict';constassert=require('assert');constasync_hooks=require('async_hooks');consthttp=require('http');constN=50;constKEEP_ALIVE=100;constdestroyedIds=[];async_hooks.createHook({destroy: (asyncId)=>{assert(!destroyedIds.includes(asyncId),`${asyncId} already in ${destroyedIds.sort()}`);destroyedIds.push(asyncId);}}).enable();constserver=http.createServer(function(req,res){res.end('Hello');});constkeepAliveAgent=newhttp.Agent({keepAlive: true,keepAliveMsecs: KEEP_ALIVE,});letM=0;server.listen(0,function(){for(leti=0;i<N;++i){(functionmakeRequest(){http.get({port: server.address().port,agent: keepAliveAgent},function(res){res.resume();M++;if(M===N)server.close();assert.ok(M<=N);});})();}});Metadata
Metadata
Assignees
Labels
async_hooksIssues and PRs related to the async hooks subsystem.Issues and PRs related to the async hooks subsystem.confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.