Skip to content

[3.8 regression] Deadlock with async_to_syncsync_to_asyncasync_to_synccreate_tasksync_to_async #492

Open
@andersk

Description

@andersk

This code, minimized from the Zulip server, worked in asgiref 3.7.2, but deadlocks in 3.8.0, 3.8.1, and current main (abc69a0). A Git bisection implicates d920c3c as the first broken commit:

import asyncio

from asgiref.sync import async_to_sync, sync_to_async


async def inner() -> asyncio.Task[None]:
    return asyncio.create_task(sync_to_async(print)("inner"))


async def main() -> None:
    task = await sync_to_async(async_to_sync(inner))()
    await task


async_to_sync(main)()

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