-
Notifications
You must be signed in to change notification settings - Fork 30k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
MaxListenersExceededWarning when installing or creating Node.js projects on macOS #49269
Comments
I have the same issue, when I call a node 20.5.1 This seems to be because the number of event listeners for Line 270 in d2c7c36
process will emit warning Lines 585 to 592 in d2c7c36
emitter: <ref *1> TLSSocket {
_tlsOptions: {
allowHalfOpen: undefined,
pipe: false,
secureContext: [SecureContext],
isServer: false,
requestCert: true,
rejectUnauthorized: true,
session: undefined,
ALPNProtocols: undefined,
requestOCSP: undefined,
enableTrace: undefined,
pskCallback: undefined,
highWaterMark: undefined,
onread: undefined,
signal: undefined
},
_secureEstablished: false,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: true,
_SNICallback: null,
servername: null,
alpnProtocol: null,
authorized: false,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype] {
close: [Array],
end: [Array],
newListener: [Array],
connect: [Array],
secure: [Function: onConnectSecure],
session: [Function (anonymous)],
free: [Function: onFree],
timeout: [Array],
agentRemove: [Function: onRemove],
error: [Function: socketErrorListener],
data: [Function: socketOnData],
drain: [Function: ondrain]
},
_eventsCount: 12,
connecting: true,
_hadError: false,
_parent: null,
_host: 'mainnet.infura.io',
_closeAfterHandlingError: false,
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [],
flowing: true,
ended: false,
endEmitted: false,
reading: false,
constructed: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: false,
autoDestroy: true,
destroyed: false,
errored: null,
closed: false,
closeEmitted: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
dataEmitted: false,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
_maxListeners: undefined,
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: false,
defaultEncoding: 'utf8',
length: 215,
writing: true,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: [Function (anonymous)],
writelen: 215,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 1,
constructed: true,
prefinished: false,
errorEmitted: false,
emitClose: false,
autoDestroy: true,
errored: null,
closed: false,
closeEmitted: false,
[Symbol(kOnFinished)]: []
},
allowHalfOpen: false,
_sockname: null,
_pendingData: [ [Object], [Object], [Object], allBuffers: false ],
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
timeout: 5000,
parser: HTTPParser {
'0': null,
'1': [Function: parserOnHeaders],
'2': [Function: parserOnHeadersComplete],
'3': [Function: parserOnBody],
'4': [Function: parserOnMessageComplete],
'5': null,
'6': null,
_headers: [],
_url: '',
socket: [Circular *1],
incoming: null,
outgoing: [ClientRequest],
maxHeaderPairs: 2000,
_consumed: false,
onIncoming: [Function: parserOnIncomingClient],
joinDuplicateHeaders: undefined,
[Symbol(resource_symbol)]: [HTTPClientAsyncResource]
},
_httpMessage: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: false,
chunkedEncoding: false,
shouldKeepAlive: true,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
strictContentLength: false,
_contentLength: '60',
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
_closed: false,
socket: [Circular *1],
_header: 'POST /v3/46bd2d5bcfe14e12b5468f9b3a95eac7 HTTP/1.1\r\n' +
'content-type: application/json\r\n' +
'Content-Length: 60\r\n' +
'Host: mainnet.infura.io\r\n' +
'Connection: keep-alive\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: [Agent],
socketPath: undefined,
method: 'POST',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
joinDuplicateHeaders: undefined,
path: '/v3/46bd2d5bcfe14e12b5468f9b3a95eac7',
_ended: false,
res: null,
aborted: false,
timeoutCb: [Function: emitRequestTimeout],
upgradeOrConnect: false,
parser: [HTTPParser],
maxHeadersCount: null,
reusedSocket: false,
host: 'mainnet.infura.io',
protocol: 'https:',
[Symbol(kCapture)]: false,
[Symbol(kBytesWritten)]: 0,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype],
[Symbol(errored)]: null,
[Symbol(kHighWaterMark)]: 16384,
[Symbol(kRejectNonStandardBodyWrites)]: false,
[Symbol(kUniqueHeaders)]: null
},
autoSelectFamilyAttemptedAddresses: [
'34.234.166.131:443',
'54.164.79.19:443',
'54.174.23.177:443',
'54.225.151.145:443',
'3.219.184.255:443',
'3.233.7.93:443',
'34.204.32.68:443'
],
handle: TLSWrap {
_parent: [TCP],
_parentWrap: null,
_secureContext: [SecureContext],
reading: false,
onkeylog: [Function: onkeylog],
onhandshakestart: {},
onhandshakedone: [Function (anonymous)],
onocspresponse: [Function: onocspresponse],
onnewsession: [Function: onnewsessionclient],
onerror: [Function: onerror],
[Symbol(owner_symbol)]: [Circular *1]
},
[Symbol(alpncallback)]: null,
[Symbol(res)]: TLSWrap {
_parent: [TCP],
_parentWrap: null,
_secureContext: [SecureContext],
reading: false,
onkeylog: [Function: onkeylog],
onhandshakestart: {},
onhandshakedone: [Function (anonymous)],
onocspresponse: [Function: onocspresponse],
onnewsession: [Function: onnewsessionclient],
onerror: [Function: onerror],
[Symbol(owner_symbol)]: [Circular *1]
},
[Symbol(verified)]: false,
[Symbol(pendingSession)]: null,
[Symbol(async_id_symbol)]: 541,
[Symbol(kHandle)]: TLSWrap {
_parent: [TCP],
_parentWrap: null,
_secureContext: [SecureContext],
reading: false,
onkeylog: [Function: onkeylog],
onhandshakestart: {},
onhandshakedone: [Function (anonymous)],
onocspresponse: [Function: onocspresponse],
onnewsession: [Function: onnewsessionclient],
onerror: [Function: onerror],
[Symbol(owner_symbol)]: [Circular *1]
},
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: Timeout {
_idleTimeout: 5000,
_idlePrev: [Timeout],
_idleNext: [Timeout],
_idleStart: 1750,
_onTimeout: [Function: bound ],
_timerArgs: undefined,
_repeat: null,
_destroyed: false,
[Symbol(refed)]: false,
[Symbol(kHasPrimitive)]: false,
[Symbol(asyncId)]: 83,
[Symbol(triggerId)]: 0
},
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kSetNoDelay)]: false,
[Symbol(kSetKeepAlive)]: false,
[Symbol(kSetKeepAliveInitialDelay)]: 0,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: {
rejectUnauthorized: true,
ciphers: 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA',
checkServerIdentity: [Function: checkServerIdentity],
minDHSize: 1024,
protocol: 'https:',
hostname: 'mainnet.infura.io',
port: 443,
path: null,
method: 'POST',
headers: [Object],
_defaultAgent: [Agent],
host: 'mainnet.infura.io',
keepAlive: true,
scheduling: 'lifo',
timeout: 5000,
noDelay: true,
servername: 'mainnet.infura.io',
_agentKey: 'mainnet.infura.io:443:::::::::::::::::::::',
encoding: null,
keepAliveInitialDelay: 1000
}
},
type: 'close',
count: 11
} codevar request = require('request');
var options = {
method: 'POST',
url: 'https://mainnet.infura.io/v3/46bd2d5bcfe14e12b5468f9b3a95eac7',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
jsonrpc: '2.0',
method: 'net_version',
params: [],
id: 67,
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
process.on('warning', (w) => {
console.log(w);
}); |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Version
20.5.1
Platform
macOS (darwin)
Subsystem
No response
What steps will reproduce the bug?
I am getting the following warning message when I try to install or create Node.js projects on macOS:
(node:80101) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [TLSSocket]. Use emitter.setMaxListeners() to increase limit
I have updated Node.js to the latest version (V20.5.1) and npm was already up to date (V9.8.1). I'm not using any third-party tools, I simply use terminal.
The commands I get the warning after are:
npm install ...
and
npx ...
I'd appreciate if anyone can help me with this. So far i haven't noticed anything wrong in projects or installing process except the warning itself, but I don't understand why should the warning pop-up when I haven't made any changes to any configurations in NPM or node.
How often does it reproduce? Is there a required condition?
It happens every time I try to install (with NPM) or create a project (with NPX), no special condition produces it, it just comes up.
What is the expected behavior? Why is that the expected behavior?
Expected behavior is, NPM should normally just install and NPX should normally just create the project without any warnings!
What do you see instead?
The warning message before completion of install or create:
(node:80101) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [TLSSocket]. Use emitter.setMaxListeners() to increase limit
Additional information
No response
The text was updated successfully, but these errors were encountered: