question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dictionary changed size during iteration

See original GitHub issue

Hi there!

I’ve just upgraded from cheroot==8.4.4 to cheroot==8.4.5 and I noticed what looks like a regression.

I’m submitting a …

  • 🐞 bug report

🐞 Describe the bug. What is the current behavior?

I see this in my server logs:

Error in HTTPServer.tick
Traceback (most recent call last):
  File ".../lib/site-packages/cheroot/server.py", line 1798, in serve
    self.tick()
  File ".../lib/site-packages/cheroot/server.py", line 2046, in tick
    self._connections.expire()
  File ".../lib/site-packages/cheroot/connections.py", line 105, in expire
    in self._selector.get_map().items()
  File ".../lib/_abcoll.py", line 414, in items
    return [(key, self[key]) for key in self]
RuntimeError: dictionary changed size during iteration

What is the motivation / use case for changing the behavior?

There is occasional log spam (for a low traffic environment), but I assume this has some other undesired side-effects…

💡 To Reproduce

I’m not sure exactly. We have a test environment with synthetic checks that does a couple requests per second and the behaviour occurs “naturally”…

📋 Details

We very recently upgraded from version 8.4.4 to 8.4.5, but it’s possible the error was already present in 8.4.4. We use pip-compile and cheroot is not pinned, so we usually get updates shortly after they are released.

📋 Environment

  • Cheroot version: 8.4.5
  • CherryPy version: 17.4.2 (I don’t think we really use it)
  • Python version: 2.7
  • OS: Windows
  • Browser: requests

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
AndreLouisCaroncommented, Nov 24, 2020

Thanks a lot for the fix! I’m rolling that out to our test environments and will confirm the fix later this week 😃

1reaction
jaracocommented, Nov 24, 2020

Fix from #337 is now released as 8.4.8. Please verify the fix and report back here. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

dictionary changed size during iteration" error? - Stack Overflow
The Python "RuntimeError: dictionary changed size during iteration" occurs when we change the size of a dictionary when iterating over it. · To...
Read more >
RuntimeError: dictionary changed size during iteration
The Python "RuntimeError: dictionary changed size during iteration" occurs when we change the size of a dictionary when iterating over it.
Read more >
Runtimeerror: Dictionary Changed Size During Iteration
The runtimeerror: dictionary changed size during iteration occurs whenever you modify entries in a dictionary object during iteration.
Read more >
Dictionary Changed Size During Iteration: Its Origins and Fixes
Dictionary changed size during iteration error occurs as a result of any modifications, removal, or addition of new entries for a dictionary object....
Read more >
Filtering Dictionary In Python 3. “RuntimeError - codeburst
“RuntimeError : Dictionary changed size during iteration”, Python slaps you in your face when you try to add/remove entries in dict object during...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found