Repository navigation
fix: restore Windows DLL search paths after failed loads - #2425
Open
remote-controlled-man wants to merge 2 commits into
Open
remote-controlled-man wants to merge 2 commits into
remote-controlled-man wants to merge 2 commits into
Conversation
This branch has not been deployed
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.
Fixes #2424.
Failed Windows library loads leave an extra library-directory entry in
PATHand unclosed DLL search-directory registrations, so retrying an unavailable installation keeps changing process state.Roll back changes made by an unsuccessful load, including a missing library or a failure partway through CUDA/HIP directory registration.
Register the library directory once per attempt and avoid prepending a duplicate
PATHentry.Keep dependency search paths after a successful load, and preserve earlier successful registrations when a later load fails.
Add regression tests for retries, CUDA/HIP paths, partial setup, missing libraries, absent/empty/existing
PATH, successful loads and non-Windows controls.Validation on macOS 26.7.3 arm64, Python 3.12.14, using the pinned native llama.cpp build (Metal and CPU support):
make test: 44 passed, including the real-model tests.make lint: Ruff checks and all 30 Python files pass the format check.ctypes.CDLLfailure repeated three times also leavesPATHunchanged with the fix; the original adds three entries.The Windows regression tests replace the platform APIs at the loader boundary.
An actual Windows DLL integration run has not been performed locally.