Reproduce license cache inheritance failure #4709#5237
Draft
hakandilek wants to merge 1 commit into
Draft
Conversation
ScanCode warms the license cache before creating its process pool. Linux Python 3.14 uses forkserver by default, so workers do not inherit that state and load private copies. Add a lightweight sentinel test for this boundary without loading the real license index. The test intentionally fails under the current Python 3.14 Linux pool behavior. Signed-off-by: Hakan Dilek <hakandilek@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a lightweight reproducer for the multiprocessing license-cache
inheritance failure reported in #4709, and a possible fix following a short
discussion.
Root cause: ScanCode warms the license cache in the parent process before
creating its worker pool. Linux Python 3.13 uses
fork, so workers inheritthe warmed cache through copy-on-write. Python 3.14 uses
forkserverbydefault, so workers start without that state and load private copies of the
license index.
Reproducer
The test substitutes a small sentinel for the real license cache and creates
a worker through the production
scancode.pool.get_pool()function.This exercises the same inheritance boundary without:
Expected behavior on the current code:
forkforkserverspawnThe test is collected by the
core_tests / misc_and_scancodejob defined in
azure-pipelines.yml, running on Ubuntu 24.04 with Python3.14.
Scope
This Draft PR initially contains only the reproducer and no production fix.
I would like maintainer feedback on the preferred fix direction before
adding one.
Tests do not currently pass on Linux Python 3.14. This failure is
intentional while the PR is a Draft and demonstrates the regression.
Reproduces #4709.
Verification