Skip to content

FIX register() misses libraries listed before it was called - #5

Closed
cakedev0 wants to merge 1 commit into
masterfrom
fix-register-cache
Closed

cakedev0 wants to merge 1 commit into
masterfrom
fix-register-cache

Conversation

@cakedev0

Copy link
Copy Markdown
Owner

Since joblib#249, _CDLLCache remembers, for the lifetime of the process, every listed library that no controller matched. register() didn't clear that cache, so a library listed before the call was never matched by the new controller. On Linux every loaded .so is listed, so any ThreadpoolController() or threadpool_info() call made before register(), by any package, was enough to hide the library. The controller returned by get_cached_controller() (joblib#257) wasn't refreshed either.

This PR clears both in register(). Clearing only the unmatched entries would be enough, but register() is rare, so clearing everything costs one extra scan.

test_custom_controller didn't catch this because tests/_pyMylib loads its library and registers the controller in the same import. The new test runs in a subprocess, so the registered controller doesn't leak into other tests. It is Linux-only because it matches glibc. It fails if either of the two lines is removed.

This regression was never released, so there is no changelog entry.

🤖 Generated with Claude Code

Clear the cache of unmatched libraries, and the controller returned by
get_cached_controller(), when a new controller is registered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cakedev0

Copy link
Copy Markdown
Owner Author

Opened upstream as joblib#287.

@cakedev0 cakedev0 closed this Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant