squeaky-pl / japronto

Screaming-fast Python 3.5+ HTTP toolkit integrated with pipelining HTTP server based on uvloop and picohttpparser.
MIT License
8.61k stars 581 forks source link

Use copy of sys.modules.items() to avoid runtime error in reloader #66

Closed ObviouslyGreen closed 7 years ago

ObviouslyGreen commented 7 years ago

Been running into this every once and a while

 File ".../python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File ".../python3.5/site-packages/japronto/reloader.py", line 83, in run
    for changed in change_detector():
  File ".../python3.5/site-packages/japronto/reloader.py", line 56, in change_detector
    for name, module in sys.modules.items():
RuntimeError: dictionary changed size during iteration

Similar issue to https://github.com/cherrypy/cherrypy/issues/1280