Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Eager task factory segfaults when hosting and calling an API from the same event loop #122332

Closed
Labels
3.12only security fixes3.13bugs and security fixes3.14bugs and security fixestopic-asynciotype-crashA hard crash of the interpreter, possibly with a core dump
@irgolic

Description

@irgolic

Crash report

What happened?

Love eager task factory, but it's crashing one of my tests. I'm usinguvicorn andfastapi to host an API, and testing it withhttpx running in the same event loop. This reliably produces a segfault.

It seems to only happen with streaming responses.

Here's a minimal code example:

importasyncioimporthttpximportuvicornfromfastapiimportFastAPIfromstarlette.responsesimportStreamingResponseasyncdefmain():loop=asyncio.get_running_loop()loop.set_task_factory(asyncio.eager_task_factory)app=FastAPI()@app.get("/")asyncdefget():asyncdef_():yield"1"returnStreamingResponse(_(),        )server=uvicorn.Server(uvicorn.Config(app,host="0.0.0.0",port=8080,        )    )asyncio.create_task(server.serve())client=httpx.AsyncClient()awaitclient.get("http://localhost:8080")if__name__=="__main__":asyncio.run(main())

CPython versions tested on:

3.12

Operating systems tested on:

macOS

Output from running 'python -VV' on the command line:

Python 3.12.3 | packaged by conda-forge | (main, Apr 15 2024, 18:35:20) [Clang 16.0.6 ]

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13bugs and security fixes3.14bugs and security fixestopic-asynciotype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp