You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sklearn.callbacks._transport.open_listener should document thread-safety requirements #34145
The message_consumer callable argument to sklearn.callbacks._transport.open_listener() can be called from multiple threads within the same process, when using a thread pool instead of a process pool. That means it needs to be thread-safe.
In practice all callers are actually thread-safe, so that's not a problem.
However, this requirement is not documented.
Suggest a potential alternative/fix
Add a note saying that the message_consumer might be called from multiple different threads and must be prepared to handle this correctly.
Hi, I looked into this issue and cloned the current main branch to check. The thread-safety requirement for message_consumer is already documented in the current docstring for open_listener in sklearn/callback/_transport.py:
"This callable may be called from multiple different threads, and must therefore behave in a thread-safe manner."
It looks like this was already addressed. Could a maintainer confirm if this issue can be closed?
Activity
jeremiedbb commentedon May 28, 2026
That's correct, the message_consumer is expected to be thread safe. A improvement of the docstring of
open_listeneris welcome.Git169-hub commentedon Jun 1, 2026
Hi, I looked into this issue and cloned the current main branch to check. The thread-safety requirement for message_consumer is already documented in the current docstring for open_listener in sklearn/callback/_transport.py:
"This callable may be called from multiple different threads, and must therefore behave in a thread-safe manner."
It looks like this was already addressed. Could a maintainer confirm if this issue can be closed?