Open michivi opened 2 years ago
Hey @michivi thanks for reporting this bug.
OPAL uses and supports Redis via the python broadcaster package. We are looking to move away from or fork broadcaster since it's no longer actively maintained (that we can tell).
@roekatz can you please take a look? we can fix that in our own fork of broadcaster.
Describe the bug This is basically to report some weird behaviors when using OPAL with Redis:
To Reproduce We had this issue on a testing cloud environment, but we can also reproduce it with Docker compose. The following is an abbreviated version of the official example that we use to test OPAL locally. Every environment variables are provided by the running script. I'm not disclosing their actual values as they're sensitive, but I'll happily discuss them if required (nothing really extraordinary though 🙂).
Note here that
UVICORN_NUM_WORKERS
is set to4
. Running this, we'll have the following logs (I'll remove uninteresting lines but can provide them if required):We can see several things here:
webhook listener triggered
only appears randomly)As suggested in the Slack thread, setting
UVICORN_NUM_WORKERS
to1
seems to resolve the second point (the webhook listener is always triggered afterward). But the Redis connection is still reported as lost.Just as an experiment, I tried publishing some messages in the Redis instance (
hello
, still with a single worker) and ended up with the following logs:So it seems that the Redis connection is actually still alive, and OPAL is still listening to it. It only considers the connection lost when it receives a webhook notification. Though it does so after reading the incoming notification so at the very least the webhook notification is taken into account.
Expected behavior Is Redis officially supported by OPAL? I've seen few references to it. It is supported by the
broadcaster
package and the example docker-compose.yaml file suggests that any backend supported bybroadcaster
is supported by OPAL.If Redis is officially supported, then I guess the expected behavior would be:
OPAL version
Have I missed something that might explain all of this? When testing the
fastapi_websocket_pubsub
, I didn't have Redis connection issue / message.Thanks in advance for your help 🙂