new connected channels may fail to receive message from group_send()
See original GitHub issueIt 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.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:35 (10 by maintainers)
Top Results From Across the Web
Django Channels group send only sends the message to last ...
it receive the message from a channel and send back to that channel to the number of connected channels in chat_room. ~ thanks...
Read more >Channel Layers — Channels 4.0.0 documentation
Any message sent to that channel name - or to a group the channel name was added to - will be received by...
Read more >Tests randomly failing with error "No connection could be ...
I am randomly getting the below error while executing the test but second time same test executes successfully. Tests executed from the automation...
Read more >Introduction to Django Channels - TestDriven.io
Inside receive() we parsed the data to JSON and extracted the message . Then, we forwarded the message using group_send to chat_message ....
Read more >Django Channels and WebSockets - LogRocket Blog
Learn how to use Django Channels and WebSockets, a new protocol that ... res): """ Receive message from room group """ # Send...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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