Skip to content

RuntimeError: set changed size during iteration #496

Closed

Description

@janbuchar
  • uvloop version: 0.16.0
  • Python version: 3.10.2
  • Platform: 64-bit Linux
  • Can you reproduce the bug with PYTHONASYNCIODEBUG in env?: not able to test
  • Does uvloop behave differently from vanilla asyncio? How?: not able to test

I run a fastapi application with uvicorn, and I occassionally receive the following error:

Traceback (most recent call last):
  File "uvloop/cbhandles.pyx", line 66, in uvloop.loop.Handle._run
  File "uvloop/loop.pyx", line 473, in uvloop.loop.Loop._on_idle
  File "uvloop/loop.pyx", line 649, in uvloop.loop.Loop._exec_queued_writes
RuntimeError: set changed size during iteration

This seems to only happen in a production environment and I don't have the resources to examine it further. However, it seems that the code in the uvloop master branch is different, so maybe the error has been fixed already.

Activity

  1. fantix commented on Sep 13, 2022

    @fantix
    Member

    Thanks for the report! I can reproduce this issue, and it is a bug that sometimes happens when writing to another transport in the resume_writing() handler. I'll try to fix it and include the fix in the next release.

  2. added a commit that references this issue on Sep 13, 2022
    05c6fcc
  3. added a commit that references this issue on Sep 13, 2022
    d2deffe
  4. janbuchar commented on Sep 14, 2022

    @janbuchar
    Author

    Thank you @fantix for resolving this so fast!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions