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 conditions in FileSystemBytecodeCache #1655

Merged
merged 1 commit into from Apr 25, 2022

Conversation

dvitek
Copy link
Contributor

@dvitek dvitek commented Apr 10, 2022

Fix race conditions in FileSystemBytecodeCache. See #1654 for a detailed description of the race conditions.

Checklist:

  • Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • Add or update relevant docs, in the docs folder and in code.
  • Add an entry in CHANGES.rst summarizing the change and linking to the issue.
  • [n/a] Add .. versionchanged:: entries in any relevant code docs.
  • Run pre-commit hooks and fix any issues.
  • Run pytest and tox, no tests failed.

src/jinja2/bccache.py Outdated Show resolved Hide resolved
src/jinja2/bccache.py Outdated Show resolved Hide resolved
src/jinja2/bccache.py Outdated Show resolved Hide resolved
@davidism
Copy link
Member

I'm going to remove the tests because in the past having tests that relied on race conditions was very flaky and caused confusion for contributors when unrelated PRs failed.

@davidism davidism added this to the 3.1.2 milestone Apr 25, 2022
@dvitek
Copy link
Contributor Author

dvitek commented Apr 25, 2022

ok

@dvitek
Copy link
Contributor Author

dvitek commented Apr 25, 2022

FWIW, the test tests for the absence of a race, if that makes a difference. It should not fail intermittently, unless the bug is re-introduced.

@davidism
Copy link
Member

The problem with that is that there no guarantee that a race happened and was handled vs normal behavior happened. And any such check would then rely on producing the race, which is flaky.

@davidism davidism linked an issue Apr 25, 2022 that may be closed by this pull request
@davidism davidism merged commit b802b5a into pallets:3.1.x Apr 25, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

jinja2.FileSystemBytecodeCache race conditions
3 participants