Wednesday, November 23, 2016

Re: Channels: startup order of daphne and workers leads to issues

Hi Alex,

It sounds like this isn't a daphne/workers ordering bug (things just queue and run when available) but a serialisability issue - that is, you expected `websocket.connect` to run before `websocket.receive` but in the released version they will run in parallel if both have queued messages.

This is fixed in channels master and will come out in the next release, but you can opt into it in the meantime by using `@enforce_ordering(slight=True)` as a decorator on your consumers. The Channels docs has more: http://channels.readthedocs.io/en/stable/getting-started.html#enforcing-ordering

Andrew

On Tue, Nov 22, 2016 at 3:16 PM, Alex Peitsinis <alexpeitsinis@gmail.com> wrote:
Hello,

I noticed a weird thing during a deployment of a service that uses channels at work the other day. We use docker, so we have a container for daphne and a container for workers (currently 4). We start a service that some other machines connect to almost automatically (reconnecting etc), and we also patched some of the auth stuff  wrote to do authentication based on HTTP headers. So, in order to connect, you must have a header that is recognized, or else you are disconnected.

So, after the service was up, the reconnecting client was reporting that it was connected, but he did not get the response (the response is sent from the 'websocket.connect' consumer). Which means that he did connect, but none of the auth code had ran. The reason was that daphne had started before the workers, so we had docker set up the workers first and then daphne.

Is this expected behaviour or a bug? I guess it can be considered as a security bug, but not really sure.

Thanks!

--
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-users@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/9520d123-a2ec-46bc-b887-0906392074a3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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-users@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/CAFwN1urG6uSbq%2B2LWmGEar%2BC%3DKpQCQi0kYzQ%2BJfeCy7G-cmipQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment