Skip to content
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

Add threading lock to TraceNode _cache #702

Closed
wants to merge 1 commit into from
Closed

Conversation

hmstepanek
Copy link
Contributor

Overview

Adds lock to TraceNode _cache to prevent dict changed size during iteration error.

Related Github Issue

Fixes #663.

@github-actions
Copy link

github-actions bot commented Nov 29, 2022

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ PYTHON bandit 1 0 2.5s
✅ PYTHON black 1 0 0 0.46s
✅ PYTHON flake8 1 0 0.34s
✅ PYTHON isort 1 0 0 0.16s
✅ PYTHON pylint 1 0 2.2s

See errors details in artifact MegaLinter reports on CI Job page
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

Since the dictionary is changing sizes during the attempted caching of the dictionary,
this means it is being modified at the same time as it is being used. It is not just a
matter of it changing sizes during a loop so it can't be addressed by a simple caching
of the dictionary before looping). This will require a lock to prevent modification
while it is being used. This adds a threading lock to the TraceNode so that the cache
cannot be updated while it is being looped over (including while the cache is being
cached).
@TimPansino
Copy link
Contributor

Superseded by #704

@TimPansino TimPansino closed this Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RuntimeError: dictionary changed size during iteration
2 participants