-
Notifications
You must be signed in to change notification settings - Fork 924
LogSubscription warning MaxListenersExceededWarning: Possible EventTarget memory leak detected.
#3624
Comments
I just learned that the |
I guess we'll have to operate over the Note to future self:
|
Hey @codemedian, do you have a repro for me that triggers the |
Unfortunately I don't, no and I seem to have lost my POC branch that I was messing around with. When/if we get back to trying websockets I'm happy to do some more testing around this, though no plans to do it in the near future. |
… targets for internal use (#3661) # Summary Read all about why, here: https://solana.stackexchange.com/a/17971/75 Fixes #3624. # Test Plan ```ts const {createSolanaRpcSubscriptions} = require('./dist/index.node.cjs'); const abortController = new AbortController(); const solanaRpcSubscriptions = createSolanaRpcSubscriptions('ws://localhost:8900'); const sub1 = solanaRpcSubscriptions.logsNotifications( { mentions: ['1'.repeat(32)] }, { commitment: "processed" }).subscribe({abortSignal: abortController.signal}).then(() => {}); const sub2 = solanaRpcSubscriptions.logsNotifications( { mentions: ['1'.repeat(32)] }, { commitment: "confirmed" }).subscribe({abortSignal: abortController.signal}).then(() => {}); const sub3 = solanaRpcSubscriptions.logsNotifications( { mentions: ['1'.repeat(32)] }, { commitment: "finalized" }).subscribe({abortSignal: abortController.signal}).then(() => {}); ``` No more warning.
Because there has been no activity on this issue for 7 days since it was closed, it has been automatically locked. Please open a new issue if it requires a follow up. |
Overview
Hi all, I've started playing with the 2.x version of the SDK and pretty happy with it overall. I've now wanted to add 3 logsListeners with a filter of my address for the different commitment levels and while it works fine for 2 logs subscriptions, once I add a 3rd node events gets unhappy with
When I reduce the
maxSubscriptionsPerChannel
config in thecreateSolanaRpcSubscriptions
to say 2, the warning goes away fyi. The issue varies and sometimes complains aboutAbortSignal
and sometimes aboutEventTarget
Steps to reproduce
Description of bug
I did not expect to see this warning and more so would like for a way to set the limits such that it does not warn
EventTarget warning:
(node:54008) MaxListenersExceededWarning: Possible EventTarget memory leak detected. 11 error listeners added to EventTarget. MaxListeners is 10. Use events.setMaxListeners() to increase limit at [kNewListener] (node:internal/event_target:566:17) at EventTarget.addEventListener (node:internal/event_target:679:23) at Object.on (/Users/chris/Projects/spot/node_modules/@solana/subscribable/src/data-publisher.ts:28:26) at Object.on (/Users/chris/Projects/spot/node_modules/@solana/rpc-subscriptions-spec/src/rpc-subscriptions-channel.ts:38:32) at Object.on (/Users/chris/Projects/spot/node_modules/@solana/rpc-subscriptions-spec/src/rpc-subscriptions-pubsub-plan.ts:207:36) at Object.createAsyncIterableFromDataPublisher (/Users/chris/Projects/spot/node_modules/@solana/subscribable/src/async-iterable.ts:87:19) at Object.subscribe (/Users/chris/Projects/spot/node_modules/@solana/rpc-subscriptions-spec/src/rpc-subscriptions.ts:72:20) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
AbortSignal warning:
(node:54231) MaxListenersExceededWarning: Possible EventTarget memory leak detected. 11 abort listeners added to [AbortSignal]. MaxListeners is 10. Use events.setMaxListeners() to increase limit at [kNewListener] (node:internal/event_target:566:17) at [kNewListener] (node:internal/abort_controller:240:24) at EventTarget.addEventListener (node:internal/event_target:679:23) at Object.createAsyncIterableFromDataPublisher (/Users/chris/Projects/spot/node_modules/@solana/subscribable/src/async-iterable.ts:81:17) at Object.subscribe (/Users/chris/Projects/spot/node_modules/@solana/rpc-subscriptions-spec/src/rpc-subscriptions.ts:72:20) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
The text was updated successfully, but these errors were encountered: