question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Worker functionality (`runworker`) is broken in 3.0.0

See original GitHub issue

This 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:

https://github.com/django/channels/blob/3ab3f42d34da51e4d7c514c88ce6f49b722c58bf/channels/worker.py#L42

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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
carltongibsoncommented, Nov 9, 2020

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!

1reaction
davidmarquiscommented, Nov 8, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

gitSCM failed after updates - Google Groups
After this past Friday's updates (details below), all our jobs are broken - apparently because the ... runWorker(Unknown Source) at java.util.concurrent.
Read more >
aws.greengrass.Cloudwatch - Broken when network ...
Cloudwatch' ceases to work and exits unsuccessfully. After three attempts, this causes the component to go to the 'BROKEN' state, causing no more...
Read more >
Django channels websocket.receive is not handled
I'm trying to implement Django channels going through the docs. So like the docs i'm making consumers.py def ws_message(message): ...
Read more >
Forge 1.16.5 server not working atm6 - Support & Bug Reports
So I have a 1.16.5 forge Minecraft server. While running it I accidentally started another Minecraft server and now.
Read more >
Django Channels — Channels 4.0.0 documentation
To get started understanding Channels, read our Introduction, which will walk through how things work. Note. This is documentation for the 4.x series...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found