Skip to content

Fix Race conditions in FileSystemBytecodeCache#1655

Merged
davidism merged 1 commit intopallets:3.1.xfrom
dvitek:dvitek/issue1654
Apr 25, 2022
Merged

Fix Race conditions in FileSystemBytecodeCache#1655
davidism merged 1 commit intopallets:3.1.xfrom
dvitek:dvitek/issue1654

Conversation

@dvitek
Copy link
Copy Markdown
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.

Comment thread src/jinja2/bccache.py Outdated
Comment thread src/jinja2/bccache.py Outdated
Comment thread src/jinja2/bccache.py Outdated
@dvitek dvitek force-pushed the dvitek/issue1654 branch from 77111f3 to 080260f Compare April 11, 2022 13:08
@davidism
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

dvitek commented Apr 25, 2022

ok

@dvitek
Copy link
Copy Markdown
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
Copy Markdown
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