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

Fix race condition in ART configuration script #2132

Open
wants to merge 2 commits into
base: dev_1.15.0
Choose a base branch
from

Conversation

ketanri
Copy link

@ketanri ketanri commented May 3, 2023

Description

This addresses a race condition I found when running multiple scripts concurrently which all import ART. Namely, in the config.py file, since there were two separate checks for if os.path.exists(_config_path) and if not os.path.exists(_config_path), the race condition occurs if another process creates the file at _config_path in between those two checks, which can leave the _config variable uninitialized. Hence, I changed those two separate checks into an if/else.

Type of change

Please check all relevant options.

  • Improvement (non-breaking)
  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Testing

Please describe the tests that you ran to verify your changes. Consider listing any relevant details of your test configuration.

  • On my own repo, the issue stopped occurring when pointing the adversarial-robustness-toolbox package to my fork with this fix.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Signed-off-by: ketanri <[email protected]>
@beat-buesser beat-buesser self-requested a review May 4, 2023 20:58
@beat-buesser beat-buesser self-assigned this May 4, 2023
@codecov-commenter
Copy link

codecov-commenter commented May 4, 2023

Codecov Report

Merging #2132 (f6a9d2d) into dev_1.15.0 (b13f802) will decrease coverage by 1.38%.
The diff coverage is 50.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Impacted file tree graph

@@              Coverage Diff               @@
##           dev_1.15.0    #2132      +/-   ##
==============================================
- Coverage       85.63%   84.26%   -1.38%     
==============================================
  Files             297      297              
  Lines           26521    26521              
  Branches         4864     4863       -1     
==============================================
- Hits            22712    22347     -365     
- Misses           2571     2927     +356     
- Partials         1238     1247       +9     
Impacted Files Coverage Δ
art/config.py 92.85% <50.00%> (-7.15%) ⬇️

... and 15 files with indirect coverage changes

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.

None yet

3 participants