Skip to content

SyncToAsync no longer thread-sensitive #482

Open
@markgajdosik

Description

@markgajdosik

3.8.x no longer follows the thread-sensitive principle of a single executor. I have an application that worked without issues on 3.7.2, but since upgrading to Python 3.12, I also upgraded asgiref to 3.8.1 as it adds support for this version of Python. It's a REST API client powered by aiohttp that pulls data into the database.

Despite the fact that every call is thread_sensitive=True, I get deadlocks about 80% of the time. When I log the ID of the executor it wants to use in SyncToAsync.__call__, I am seeing that many executors are being spun up and used to run sync code in an async loop.

I'll try to investigate some more & provide more details, but my time on this ticket is limited and I am leaning towards a perhaps risky downgrade to more stable 3.7.2, even with Python 3.12.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions