Repository navigation
Fix : Issue #34792 about process parallelism on python 3.14 - #2
Open
Prathamj07 wants to merge 1 commit into
Open
Prathamj07 wants to merge 1 commit into
Prathamj07 wants to merge 1 commit into
Conversation
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.
Reference Issues/PRs
Fixes scikit-learn#34792.
What does this implement/fix? Explain your changes.
Pickling an estimator with a callback can race with the callback's listener thread.
When
joblibusesprefer="processes",cloudpickleserializes the estimator and its callbacks to send the next task to a worker. At the same time, a previous worker can still be sending callback messages to the main process. The listener thread appends to the callback's list while pickle is iterating over it, which can raise:This is then raised by joblib as a
PicklingError.The issue was easier to reproduce on Python 3.14 / i586 due to slower scheduling. The same problem also exists with
ScoringMonitor.This PR fixes the race by:
threading.LocktoScoringMonitorandRecordingCallback.__getstate__to copy the history safely and exclude the lock from the pickle.__setstate__to recreate the lock after unpickling.Introduce yourself
I use scikit-learn for model training and evaluation. I picked this issue up after seeing the process-parallelism pickle race described in scikit-learn#34792.
AI usage disclosure
I used AI assistance for: