fix(pathfinder): keep canary probes script-safe#1768
Merged
cpcloud merged 4 commits intoNVIDIA:mainfrom Mar 16, 2026
Merged
Conversation
Run the CTK canary probe via a dedicated module subprocess so it still gets a fresh interpreter and independent loader state without re-entering the caller's script as __main__. Made-with: Cursor
Mark the intentional subprocess launches as trusted inputs for Ruff's bandit checks and keep the affected files in hook-compliant import/format order. Made-with: Cursor
This comment has been minimized.
This comment has been minimized.
Run the canary subprocess from the parent package's import root so wheel-based CI tests do not accidentally resolve `cuda.pathfinder` from the checkout tree and fail on missing generated files. Made-with: Cursor
rwgk
reviewed
Mar 16, 2026
Collaborator
rwgk
left a comment
There was a problem hiding this comment.
I think this is good to merge with the two tiny suggested changes.
As a follow-on: could it be better to eliminate spawned_process_runner.py, and instead use the exact same approach for creating a fully isolated subprocess also for the tests?
cuda_pathfinder/cuda/pathfinder/_headers/find_nvidia_headers.py
Outdated
Show resolved
Hide resolved
Use the requested fully-isolated subprocess wording, restore the historical 1.4.0 release note text, and add new 1.4.3 release notes for the script-safety and import-root fixes instead. Made-with: Cursor
This comment has been minimized.
This comment has been minimized.
1 similar comment
|
|
That was quick, thanks! |
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.
Closes #1767.
Summary
python -m cuda.pathfinder._dynamic_libs.canary_probe_subprocessinstead ofmultiprocessingspawn, and add a regression test showing a plain caller script is executed only once.__main__, so script entrypoints without anif __name__ == \"__main__\"guard do not recurse or fail during multiprocessing startup.cuda.pathfinderdistribution as the parent. This avoids wheel-based CI importing the checkout tree copy, which can be missing generated files such ascuda.pathfinder._version, and keeps source-vs-wheel behavior consistent.spawned_process_runnerin place for the callable-based isolation paths and real-loading tests that still need it.Reviewer context
python -m ...subprocess.multiprocessing.get_context(\"spawn\")to avoid a forked child inheriting preloaded CUDA libraries from the parent and to keep the probe isolated/predictable.__main__, which is the failure mode reported in [BUG]:run_in_spawned_child_processfails if used as script #1767.python -m ...process was found to be resolvingcuda.pathfinderfrom the checkout tree becauserun-tests pathfinderruns from./cuda_pathfinder. In that environment the checkout copy can lack generated files such ascuda.pathfinder._version, so the child fails before probing.cwdto the already-imported parent package's import root makes the subprocess import the same distribution root as the parent, whether the parent came from source or from an installed wheel.Made with Cursor