Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression from last updates to channels, asgiref, and daphne. #588

Closed
matteing opened this issue Apr 3, 2017 · 7 comments
Closed

Regression from last updates to channels, asgiref, and daphne. #588

matteing opened this issue Apr 3, 2017 · 7 comments

Comments

@matteing
Copy link

matteing commented Apr 3, 2017

When running previous code that worked under these specific versions which where upgraded today to newer versions:

channels = "==1.1.1"
asgiref = "==1.0.1"
daphne = "==1.1.0"

to

channels = ""
asgiref = "
"
daphne = "*"

The code breaks completely and no websockets requests pass through. When downgrading to previous versions, the original code works excellently and sockets requests pass through the server just fine. The error given is a TypeError:

TypeError: Process-local channel names in receive() must end at the !

This has been replicated in multiple machines. Both running Ubuntu, although different distributions: Ubuntu GNOME 16.04, and Xubuntu 16.04.

The stack trace:

[1] [2017/04/03 03:06:09] HTTP GET /rooms/quiet-fire-7183 200 [0.10, 127.0.0.1:54028]
[1] [2017/04/03 03:06:10] HTTP GET /static/bundles/room_view-8a00a20e4c50b7c59202.js 200 [0.05, 127.0.0.1:54028]
[1] [2017/04/03 03:06:11] WebSocket HANDSHAKING /rooms [127.0.0.1:54030]
[1] 2017-04-03 03:06:11,823 - ERROR - worker - Error processing message with consumer rooms.consumers.ws_connect:
[1] Traceback (most recent call last):
[1]   File "/home/sergio/.local/lib/python3.5/site-packages/channels/worker.py", line 119, in run
[1]     consumer(message, **kwargs)
[1]   File "/home/sergio/.local/lib/python3.5/site-packages/channels/sessions.py", line 78, in inner
[1]     return func(*args, **kwargs)
[1]   File "/home/sergio/.local/lib/python3.5/site-packages/channels/sessions.py", line 137, in inner
[1]     requeue_messages(message)
[1]   File "/home/sergio/.local/lib/python3.5/site-packages/channels/sessions.py", line 92, in requeue_messages
[1]     channel, content = message.channel_layer.receive_many([wait_channel], block=False)
[1]   File "/home/sergio/.local/lib/python3.5/site-packages/asgiref/base_layer.py", line 43, in receive_many
[1]     return self.receive(channels, block)
[1]   File "/home/sergio/.local/lib/python3.5/site-packages/asgiref/inmemory.py", line 61, in receive
[1]     self.valid_channel_name(channel, receive=True) for channel in channels
[1]   File "/home/sergio/.local/lib/python3.5/site-packages/asgiref/inmemory.py", line 61, in <genexpr>
[1]     self.valid_channel_name(channel, receive=True) for channel in channels
[1]   File "/home/sergio/.local/lib/python3.5/site-packages/asgiref/base_layer.py", line 114, in valid_channel_name
[1]     raise TypeError("Process-local channel names in receive() must end at the !")
[1] TypeError: Process-local channel names in receive() must end at the !
[1] [2017/04/03 03:06:11] WebSocket CONNECT /rooms [127.0.0.1:54030]
[1] 2017-04-03 03:06:12,056 - ERROR - worker - Error processing message with consumer rooms.consumers.ws_message:
[1] Traceback (most recent call last):
[1]   File "/home/sergio/.local/lib/python3.5/site-packages/channels/worker.py", line 119, in run
[1]     consumer(message, **kwargs)
[1]   File "/home/sergio/.local/lib/python3.5/site-packages/channels/sessions.py", line 78, in inner
[1]     return func(*args, **kwargs)
[1]   File "/home/sergio/.local/lib/python3.5/site-packages/channels/sessions.py", line 137, in inner
[1]     requeue_messages(message)
[1]   File "/home/sergio/.local/lib/python3.5/site-packages/channels/sessions.py", line 92, in requeue_messages
[1]     channel, content = message.channel_layer.receive_many([wait_channel], block=False)
[1]   File "/home/sergio/.local/lib/python3.5/site-packages/asgiref/base_layer.py", line 43, in receive_many
[1]     return self.receive(channels, block)
[1]   File "/home/sergio/.local/lib/python3.5/site-packages/asgiref/inmemory.py", line 61, in receive
[1]     self.valid_channel_name(channel, receive=True) for channel in channels
[1]   File "/home/sergio/.local/lib/python3.5/site-packages/asgiref/inmemory.py", line 61, in <genexpr>
[1]     self.valid_channel_name(channel, receive=True) for channel in channels
[1]   File "/home/sergio/.local/lib/python3.5/site-packages/asgiref/base_layer.py", line 114, in valid_channel_name
[1]     raise TypeError("Process-local channel names in receive() must end at the !")
[1] TypeError: Process-local channel names in receive() must end at the !


@andrewgodwin
Copy link
Member

Yes, this looks like a problem with the order enforcement code I didn't pick up during testing. I'll have it fixed today or tomorrow.

@andrewgodwin
Copy link
Member

I've landed a fix that should make this work for you and modified the tests so they'll catch it - could you test it out and confirm so I can do a release?

@matteing
Copy link
Author

matteing commented Apr 3, 2017

I will try and test during the day. Thanks for the response!

@matteing
Copy link
Author

matteing commented Apr 4, 2017

Using these instructions, installed latest development version: https://channels.readthedocs.io/en/stable/installation.html#installing-the-latest-development-version

Alright, connecting to the server works and it is sending and receiving messages on clients correctly.
However, when sending to a group, on exit of one client, it seems like it is not clearing the group correctly because I am receiving this error which I didn't receive on previous release:

2017-04-04 00:27:50,827 - ERROR - server - HTTP/WS send decode error: Cann
ot dispatch message on channel 'daphne.response.qhlTkfCzZi!TyqrIFIZFb' (un
known)
2017-04-04 00:27:59,469 - ERROR - server - HTTP/WS send decode error: Cann
ot dispatch message on channel 'daphne.response.qhlTkfCzZi!TyqrIFIZFb' (un
known)
2017-04-04 00:27:59,470 - ERROR - server - HTTP/WS send decode error: Cann
ot dispatch message on channel 'daphne.response.qhlTkfCzZi!TyqrIFIZFb' (un
known)

@andrewgodwin
Copy link
Member

Ah yes, that's Daphne being a little bit more verbose than before, I need to remove that. Don't worry about it - it's perfectly normal after you disconnect a channel that's still in a group. You might want to add a Group.discard call in a disconnect handler to stop it, though.

@andrewgodwin
Copy link
Member

I've just tampered down that logging to DEBUG in the master branch, so it will be gone as of next release.

@matteing
Copy link
Author

matteing commented Apr 4, 2017

Awesome, thanks for the response. Will wait for new release.

Thanks for the super quick help! This issue has been solved.

chairco pushed a commit to chairco/channels that referenced this issue Jun 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants