Skip to content

Silently setting use_async to True when asgiref is available is non-obvious #3927

Description

@ckrivik

A few days after upgrading to Dash 4.4.0, I was having an intermittent issue due to a race condition caused by use_async turning on silently. It was an easy fix to explicitly set use_async=False, but it was non-obvious at first that this was the issue.

I'm not sure that I'd call this a "bug" since this does seem like it's intended behaviour, but it was confusing that it happened silently, so I'd like to propose some ideas that might help make this more explicit:

  • The default value for this could be set to False so that use_async isn't enabled without a clear signal of user intent. Users could still explicitly provide None if they really want use_async to be determined dynamically based on availability of asgiref.
  • Dash constructor could log a warning when it decides to automatically enable async, with a hint to set use_async=False if this was unintentional/undesired.
  • Documentation could be added/updated to explain this functionality, maybe in the docstrings for the Dash() constructor, the API Reference Page, and/or a "Migrating to Dash 4" page?

Hope this helps!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2considered for next cyclebugsomething brokensize: 3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions