Skip to content

Daphne 3.0 problem with request-response when working with Channels #345

Description

@Ivo-Donchev

Hi,

I'm facing a strange issue with Daphne 3 + Channels 3.0.2 and handling multiple request.
I setup a really simple project so we have a base for discussion :)
So, I'm running the project on OS Ubuntu 18.04 with python 3.7.
My requirements are:

Django==3.1.3
daphne==3.0.0
channels==3.0.2
django-environ==0.4.5

My setup

  1. I registered channels in installed apps and pointed to this routing:
application = ProtocolTypeRouter({
    'websocket': URLRouter([])
})

  1. I added 2 simple views:
def view_1(request):  # Url is `/1/`
    make_it_slow()  # Sleeps for 3 seconds
    return HttpResponse('view_1 response')


def view_2(request):  # Url is `/2/`
    make_it_slow()  # Sleeps for 3 seconds
    return HttpResponse('view_2 response')
  1. I ran the application:
daphne daphne_3_issue_demo.asgi:application

The issue

So I opened 2 shells and ran these in parralel:
curl http://localhost:8000/1/ and curl http://localhost:8000/2/

So what I noticed is that the first finished response arrives to the last requesting client and the other request just hangs until it times out.

Here's what I mean:
daphne_issue

P.S.: I think this issue is extending the existing one but it's not the exactly the same.

Best regards,
Ivo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions