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

channels 1.1.2 "__asgi_channel__" not in message AssertionError #587

Closed
kradem opened this issue Apr 2, 2017 · 5 comments
Closed

channels 1.1.2 "__asgi_channel__" not in message AssertionError #587

kradem opened this issue Apr 2, 2017 · 5 comments

Comments

@kradem
Copy link

kradem commented Apr 2, 2017

OS

Linux 4.4.0-71-generic 92-Ubuntu SMP Fri Mar 24 12:59:01 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Python

Python 3.5.2

channels

asgi-redis==1.2.0
asgiref==1.1.0
attrs==16.3.0
autobahn==0.18.1
Automat==0.5.0
channels==1.1.2
constantly==15.1.0
daphne==1.2.0
Django==1.10.6
futures==3.0.5
incremental==16.10.1
msgpack-python==0.4.8
packaging==16.8
pika==0.10.0
pyparsing==2.2.0
redis==2.10.5
requests==2.13.0
six==1.10.0
Twisted==17.1.0
txaio==2.6.2
zope.interface==4.3.3

server

python manage.py runserver

environment

I made a branch of django-examples after I located bug in my own project:

https://github.com/kradem/channels-examples/tree/channels-1.1.2

If I reset channels to the one version before:
pip uninstall daphne channels asgi-redis asgiref
pip install daphne==1.1.0 channels==1.1.1 asgi-redis==1.1.0 asgiref==1.0.1

everything works as expected, so I kind of assume my own understanding and implementation of new WebSocketBridge doesn't cause this.

error

After client tries to send to a group this happens:

[2017/04/02 12:32:49] HTTP GET / 200 [0.05, 127.0.0.1:57524]
[2017/04/02 12:32:49] WebSocket DISCONNECT /chat/stream/ [127.0.0.1:57544]
[2017/04/02 12:32:49] HTTP GET /static/css/style.css 200 [0.04, 127.0.0.1:57524]
[2017/04/02 12:32:49] HTTP GET /static/js/jquery-1.12.2.min.js 200 [0.04, 127.0.0.1:57846]
[2017/04/02 12:32:49] HTTP GET /static/channels/js/websocketbridge.js 200 [0.04, 127.0.0.1:57848]
[2017/04/02 12:32:49] WebSocket HANDSHAKING /chat/stream/ [127.0.0.1:57850]
[2017/04/02 12:32:49] WebSocket CONNECT /chat/stream/ [127.0.0.1:57850]
[2017/04/02 12:32:51] WebSocket HANDSHAKING /chat/stream/ [127.0.0.1:57860]
[2017/04/02 12:32:51] WebSocket CONNECT /chat/stream/ [127.0.0.1:57860]
Exception in thread Thread-3:
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/home/kradem/.virtualenvs/multichat/lib/python3.5/site-packages/channels/management/commands/runserver.py", line 166, in run
worker.run()
File "/home/kradem/.virtualenvs/multichat/lib/python3.5/site-packages/channels/worker.py", line 151, in run
consumer_finished.send(sender=self.class)
File "/home/kradem/.virtualenvs/multichat/lib/python3.5/site-packages/django/dispatch/dispatcher.py", line 191, in send
response = receiver(signal=self, sender=sender, **named)
File "/home/kradem/.virtualenvs/multichat/lib/python3.5/site-packages/channels/message.py", line 93, in send_and_flush
sender.send(message, immediately=True)
File "/home/kradem/.virtualenvs/multichat/lib/python3.5/site-packages/channels/channel.py", line 88, in send
self.channel_layer.send_group(self.name, content)
File "/home/kradem/.virtualenvs/multichat/lib/python3.5/site-packages/asgi_redis/core.py", line 332, in send_group
self.send(channel, message)
File "/home/kradem/.virtualenvs/multichat/lib/python3.5/site-packages/asgi_redis/core.py", line 147, in send
assert "asgi_channel" not in message
AssertionError

If the bug doesn't appear immediately just try with another browser and user in the same room.

Regards and my apologies if this is caused by my dumb implementation.

P.S. affects both asgiref.inmemory.ChannelLayer and asgi_redis.RedisChannelLayer backends.

@khasanovbi
Copy link
Contributor

Duplicate django/channels_redis#35

@kradem
Copy link
Author

kradem commented Apr 2, 2017

Ouch... Tnx.

At least this could help to position the bug into the proper package :) as I may confirm it affects asgiref.inmemory.ChannelLayer backend too.

@andrewgodwin
Copy link
Member

It is a bug in all three backends. I'm working on a fix today.

@kradem
Copy link
Author

kradem commented Apr 2, 2017

Best regards guys and thanks for the great project!

@andrewgodwin
Copy link
Member

This has been fixed and released in asgiref==1.1.1, asgi_redis==1.2.1 and asgi_ipc==1.3.1.

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

3 participants