channels: new connected channels may fail to receive message from group_send()
It looks occasionally some channels won’t receive messages from using group_send()
, although they all successfully connected to our server. Disconnected and re-connect may resolve the issue.
Here is the sample:
two clients connected via websocket and joined a same group partner_orders_1531
127.0.0.1:6379[1]> zrange asgi::group:partner_orders_1531 0 -1 withscores
1) "specific.mrOZIufu!GAaMMeISqdry"
2) "1549585254.4294083"
3) "specific.qUSiCEQD!TGlphabkczyd"
4) "1549585307.3211055"
then calling async_to_sync(channel_layer.group_send)
channel_layer = get_channel_layer()
async_to_sync(channel_layer.group_send)(partner_order_group_name, order_data)
but only one channel with channel name qUSiCEQD!TGlphabkczyd
was able to receive the message and triggered
class PartnerOrderConsumer(WebsocketConsumer):
...
def order_receive(self, event):
self.send(text_data=event["text"])
related redis log :
Pip & Environment: Python 3.6.6 channels==2.1.5 channels-redis==2.3.1 daphne==2.2.3 Django==1.11.10 The server is hosted on Ubuntu 16.04.5 LTS with 2vCPUs/4GB MEMORY by Digitalocean. We have two daphne instances and using nginx for load balancing.
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 4
- Comments: 35 (10 by maintainers)
same issue here, please help, thanks!
We experience this issue as well. At first we thought it was an issue with the channels-redis backend so we moved over to a rabbitmq backend, but this has not solved the problem. It seems that daphne workers timeout to their backend and stop receiving subscribed group_sends