Channels: channel_layer appears to time out

34 views
Skip to first unread message

oper...@tobyz.net

unread,
Mar 1, 2018, 4:46:58 PM3/1/18
to Django users
Hello,

I have a project that uses Channels as a worker queue, with a SyncConsumer that runs a heavy computation task. This works great.

I transitioned the project to have a 'task in process' page that opens a websocket and through the magic of channel's groups it gets pushed the computation updates as they happen. This works great.

I'm now transitioning the project to be a single-page-app that communicates via a websocket. Using `runserver`, this works great, the websocket stays open. However, the messages from the SyncConsumer stop after a few seconds. I've established that time is whatever the value of `websocket_handshake_timeout` is, but this doesn't make sense to me AFAIK as the channel_layer is independent from the JsonWebsocketConsumer instance, and the websocket is happily connected and still passing messages.

Any ideas? Is this a bug or am I doing something wrong? 

Thanks,

Toby

Andrew Godwin

unread,
Mar 1, 2018, 4:48:59 PM3/1/18
to django...@googlegroups.com
Hi Toby,

Do you have the latest versions of daphne, channels, asgiref and channels_redis? This sounds supiciously like a bug I fixed a couple weeks ago.

Andrew

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a329b26e-89f5-42d1-86b2-28ad1c85bb90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

oper...@tobyz.net

unread,
Mar 2, 2018, 7:13:40 AM3/2/18
to Django users
Andrew,

Thanks for taking the time to reply. 

In classic fashion, the issue has gone away and I'm not entirely sure why. I suspect there might have been a page with older code buried somewhere, trying to do websocket things wrongly, and that was throwing things off. I'm sure it will rear it's head again, and if it does I will try and get a reproducible test case.

Toby


On Thursday, March 1, 2018 at 9:48:59 PM UTC, Andrew Godwin wrote:
Hi Toby,

Do you have the latest versions of daphne, channels, asgiref and channels_redis? This sounds supiciously like a bug I fixed a couple weeks ago.

Andrew
On Thu, Mar 1, 2018 at 5:45 AM, <oper...@tobyz.net> wrote:
Hello,

I have a project that uses Channels as a worker queue, with a SyncConsumer that runs a heavy computation task. This works great.

I transitioned the project to have a 'task in process' page that opens a websocket and through the magic of channel's groups it gets pushed the computation updates as they happen. This works great.

I'm now transitioning the project to be a single-page-app that communicates via a websocket. Using `runserver`, this works great, the websocket stays open. However, the messages from the SyncConsumer stop after a few seconds. I've established that time is whatever the value of `websocket_handshake_timeout` is, but this doesn't make sense to me AFAIK as the channel_layer is independent from the JsonWebsocketConsumer instance, and the websocket is happily connected and still passing messages.

Any ideas? Is this a bug or am I doing something wrong? 

Thanks,

Toby

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

toby @ tobyz

unread,
Mar 9, 2018, 2:26:11 PM3/9/18
to django...@googlegroups.com
Update: there was an issue, and running the stock Ubuntu 16.04 Python was the cause; 3.5.2.

I’ve provisioned 3.6.4, and channels is doing exactly what I ask of it.
> You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/TBWZGjwOVPA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/64436f7a-18d7-452b-a9cf-3580d7636b73%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages