MagicStack / MagicStack/uvloop

AttributeError: type object 'async_generator_asend' has no attribute 'f_lineno'

Open
#699 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Cython
Stars
11.9k
Forks
616
PR merge metrics
No merged PRs in 30d

Description

Bug Description

Getting AttributeError: type object 'async_generator_asend' has no attribute 'f_lineno' exceptions when handling multipart form uploads in FastAPI with uvloop.

Environment
  • Python version: 3.12.11
  • uvloop version: 0.21.0
  • OS: Linux (Docker)
  • Framework: FastAPI with uvicorn
Steps to Reproduce
  1. Use FastAPI with uvloop enabled
  2. Upload file via multipart form data
  3. Exception appears in logs during async generator cleanup
Full Traceback
Exception ignored in: <async_generator object Request.stream at 0x7f6f1be8f920>
Traceback (most recent call last):
  File "uvloop/loop.pyx", line 3187, in uvloop.loop.Loop._asyncgen_finalizer_hook
  File "uvloop/loop.pyx", line 1289, in uvloop.loop.Loop.call_soon_threadsafe
  File "uvloop/cbhandles.pyx", line 329, in uvloop.loop.new_Handle
  File "uvloop/cbhandles.pyx", line 15, in uvloop.loop.Handle._set_loop
  File "uvloop/cbhandles.pyx", line 427, in uvloop.loop.extract_stack
  File "/usr/local/lib/python3.12/traceback.py", line 395, in extract
    return klass._extract_from_extended_frame_gen(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/traceback.py", line 418, in _extract_from_extended_frame_gen
    for f, (lineno, end_lineno, colno, end_colno) in frame_gen:
                                                     ^^^^^^^^^
  File "/usr/local/lib/python3.12/traceback.py", line 392, in extended_frame_gen
    for f, lineno in frame_gen:
                     ^^^^^^^^^
  File "/usr/local/lib/python3.12/traceback.py", line 336, in walk_stack
    yield f, f.f_lineno
             ^^^^^^^^^^
AttributeError: type object 'async_generator_asend' has no attribute 'f_lineno'

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the multipart upload with Python 3.12.11, uvloop 0.21.0, FastAPI, and uvicorn on Linux. Then inspect uvloop/loop.pyx around _asyncgen_finalizer_hook and uvloop/cbhandles.pyx around extract_stack, using the traceback.py call path as context. Done means async-generator cleanup no longer raises the reported AttributeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.