-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeError: dictionary changed size during iteration on shared self.circuits
dict
#177
Comments
@viniarck I'm very glad you found this! I've pushed commit fe44385 to fix the issues on PR #175 as a workaround for this. In the future, we can also leverage MongoDB direct queries and maybe even remove the
Please let me know if you wanna leave the issue open for handling this remaining code or even refactor to leverage MongoDB. |
@italovalcy, sounds good, I agree, shallow copy should be good for now, and then in a next opportunity try to offload more things to MongoDB. It's up to you if you'd rather use this issue for this future opportunity on MongoDB or map a new one. I also didn't find any other points than the ones you've posted here, on models/evc.py several points is passign the same ref but it's not getting inserted again from what I followed, so, it seems safe. Thanks for patching this. |
It turns out that
self.circuits
is also vulnerable toRuntimeError: dictionary changed size
, see this #175 (comment) for more info. There are more points in the code where this can happen, I'll point them out later for completeness.To facilitate to reproduce the issue:
time.sleep
on parts of the code whereself.circuits
is being iterated on without any locks or shallow copy, and then you have to force an insertion by creating a new circuit just so the iterated collection would change its size, for instance if you add thistime.sleep
:"handle_link_down before sleep..."
after you simulate a link down, if you try to create a new circuit you should get the traceback:The text was updated successfully, but these errors were encountered: