Open maurocolella opened 4 years ago
In our case: I worked around this by allowing the correct amount of listeners manually, according to the logic hereafter. Kindly note: I have verified all the dependencies, and I believe that they are consistent across - we're not using any "legacy" middleware, or skirting Apollo lifecycle events in any "visible" way.
ApolloGateway
from the @apollo/gateway
module, version ^0.21.0
at the time of this writing.serviceList: [...componentServices]
<- x2 for
SIGINTand
SIGTERM` with each service.ApolloServer, (apollo-server-express v. ^2.18.2)
export const server = new ApolloServer({
gateway,
context,
...
server.applyMiddleware({
app,
cors: cors(),
})
And so: using the manual limit, I can get rid of the error message above.
@maurocolella any news with this? My case is very simple. I'm trying to console.log the output of a DocumentClient.getInstance() .get()
method, and then in cloudwatch I got that same error than you:
undefined INFO Enabling inline tracing for this federated service. To disable, use ApolloServerPluginInlineTraceDisabled
No idea what is happening. If I remove that console.log everything goes ok.
The function doesn't get corrupted, it all works ok, but I can't do a console.log, I don't get it.
Plus, I hade to downgrade Apollo Federation and Gateway today, from latest (both) to 19.0 (both), I was having another issue reported here https://github.com/apollographql/federation/issues/211
@pmirandaarias this is just a warning. I think inline tracing is enabled automatically if an Apollo Studio key is discovered in the environment.
Should you encounter the issue above (memory leak), my second post also discusses the solution.
For the record: I am seeing an adjacent issue, with the same warning, due to the introspection requests fired by the graphql playground.
I think eventemitters should probably be disposed of asap; alternatively, might I suggest an implementation like this? https://www.npmjs.com/package/eventemitter3
If it works, it could potentially help to resolve the issue.
apollo-server-core@^2.18.2
https://github.com/apollographql/apollo-server/blob/main/packages/apollo-server-core/src/ApolloServer.ts#L358
Background: we are using apollo federation/ typescript to run multiple services on express.
Typescript requested version is 3.9.2 (actual 3.9.3 to 3.9.7).
Expected behavior: no leak.
Actual behavior: At startup, the application reports possible memory leaks.
I am not sure how to create a "simple" test case, as the application is large. I did my best to trace things, see:
It appears that the issue originates in: https://github.com/apollographql/apollo-server/blob/main/packages/apollo-server-core/src/ApolloServer.ts#L358
Thank you for your help with this.