Worker functionality (`runworker`) is broken in 3.0.0
See original GitHub issueThis issue is being created with the intent of tracking and documenting efforts following the discussion on upstream project asgiref
: https://github.com/django/asgiref/issues/209
The Worker that exists in Channels (used via the runworker
Django management command) is based on StatelessServer
in asgiref
. In the latest ASGI 3.0 specification, the spec for an Application has been changed to a single callable:
coroutine application(scope, receive, send)
When the Worker handles an incoming message from the channel layer, it currently delegates the handling of the application itself to the StatelessServer
:
This in turn tries to instantiate the Application following the old double-callable specification, which obviously doesn’t work for applications that have been upgraded to the ASGI 3.0 format. Furthermore, the underlying exception (__call__() missing 2 required positional arguments: 'receive' and 'send'
) is being muffled and nothing is being output in the Worker console as a result, which complicates diagnosing the issue.
As suggested by @carltongibson, I’m going to try to first create a failing test in Channels and see where that leads me.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9 (3 by maintainers)
Fixed in django/asgiref#209, available in asgiref 3.3.1.
Plus c.f #1567, for
StaticFilesWrapper
, which will be in Channels 3.0.2 shortly.Thanks all for the report, fixes and testing!
I can confirm this in indeed fixed by this PR to asgiref: https://github.com/django/asgiref/pull/211
… and making sure ‘as_asgi()’ is used on consumers