You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While trying to subscribe to same event more than 10 times, Directus throws the following warning:
(node:99122) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added to [EventEmitter]. Use emitter.setMaxListeners() to increase limit
at __node_internal_genericNodeError (node:internal/errors:865:15)
at _addListener (node:events:591:17)
at EventEmitter.addListener (node:events:609:10)
at on (node:events:1124:13)
at Object.subscribe (/directus/api/src/services/graphql/subscription.ts:93:26)
at subscribe.next (<anonymous>)
at <anonymous> (/directus/api/src/services/graphql/subscription.ts:26:20)
at AsyncGenerator.next (<anonymous>)
at Object.next (/directus/node_modules/.pnpm/[email protected]/node_modules/graphql/execution/mapAsyncIterator.js:43:39)
at onMessage (file:///directus/directus/node_modules/.pnpm/[email protected][email protected]/node_modules/graphql-ws/lib/server.mjs:207:180)
To Reproduce
In order to replicate this issue you need to:
set WEBSOCKETS_ENABLED: 'true'
create collection example with string fields id and name
start listening with the following code and it will throw a warning on Directus
Code
import{createClient}from"graphql-ws";importWebSocketfrom"ws";asyncfunctionstart(){try{constclient=createClient({url: "ws://localhost:8055/graphql",keepAlive: 30000,webSocketImpl: WebSocket,connectionParams: async()=>{return{access_token: "123456789"};},});constsubscription=client.iterate({query: "subscription { example_mutated { key event data { id name } } }",});forawait(consteventofsubscription){console.log(event);}}catch(error){console.log(error);}}(asyncfunction(){constitems=Array(15).fill(0);for(letiofitems){start();awaitnewPromise((res)=>setTimeout(res,1000));}})();
Describe the Bug
While trying to subscribe to same event more than 10 times, Directus throws the following warning:
To Reproduce
In order to replicate this issue you need to:
WEBSOCKETS_ENABLED: 'true'
example
with string fieldsid
andname
Code
In docs says thatWEBSOCKETS_GRAPHQL_CONN_LIMIT
is set toInfinity
: https://docs.directus.io/self-hosted/config-options.html#graphqlAlthough this configuration seems to not be used anywhere.
It is being set properly as mentioned by @br41nslug here: #21570 (comment)
Suggestion
Maybe this could be as simple as setting this:
In the following line?
directus/api/src/services/graphql/subscription.ts
Line 11 in 3e9e5ec
Directus Version
main (10.9.3)
Hosting Strategy
Self-Hosted (Custom)
The text was updated successfully, but these errors were encountered: