davidyaha / graphql-redis-subscriptions

A graphql subscriptions implementation using redis and apollo's graphql-subscriptions
MIT License
1.11k stars 125 forks source link

Error: Connection is closed. with pubsub #593

Open simplenotezy opened 1 year ago

simplenotezy commented 1 year ago

We are currently investigating restarts of our pods, and upon investigating the logs prior to a restart we observe the following:

[pod/backend-production-5b8c657b85-blltz/backend-production] This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
[pod/backend-production-5b8c657b85-blltz/backend-production] Error: Connection is closed.
[pod/backend-production-5b8c657b85-blltz/backend-production]     at EventEmitter.sendCommand (/node_modules/ioredis/built/Redis.js:328:28)
[pod/backend-production-5b8c657b85-blltz/backend-production]     at EventEmitter.unsubscribe (/node_modules/ioredis/built/utils/Commander.js:90:25)
[pod/backend-production-5b8c657b85-blltz/backend-production]     at RedisPubSub.unsubscribe (/node_modules/graphql-redis-subscriptions/dist/redis-pubsub.js:135:34)
[pod/backend-production-5b8c657b85-blltz/backend-production]     at PubSubAsyncIterator.unsubscribeAll (/node_modules/graphql-redis-subscriptions/dist/pubsub-async-iterator.js:152:25)
[pod/backend-production-5b8c657b85-blltz/backend-production]     at PubSubAsyncIterator.<anonymous> (/node_modules/graphql-redis-subscriptions/dist/pubsub-async-iterator.js:130:28)
[pod/backend-production-5b8c657b85-blltz/backend-production]     at step (/node_modules/graphql-redis-subscriptions/dist/pubsub-async-iterator.js:33:23)
[pod/backend-production-5b8c657b85-blltz/backend-production]     at Object.next (/node_modules/graphql-redis-subscriptions/dist/pubsub-async-iterator.js:14:53)
[pod/backend-production-5b8c657b85-blltz/backend-production]     at fulfilled (/node_modules/graphql-redis-subscriptions/dist/pubsub-async-iterator.js:5:58)

I notice we are a version behind (^2.4.2), so I'll go ahead and update, but I am posting this issue since I don't see anything in the changelog related to this error.

pantajoe commented 1 year ago

Same issue here. It seem, we need a way to gracefully shutdown both clients