Skip to content

Windows free-threaded Python ValueError: concurrent send_bytes() calls are not supported #30810

Open

Description

@lesteve

Noticed in build log. An automated issue was opened in #30801 and closed the next day.

This needs some investigation to figure out whether this can be reproduced locally and whether this is actually Windows-specific.

This may be a joblib issue as well.

================================== FAILURES ===================================
  _____________________________ test_absolute_error _____________________________
  
      def test_absolute_error():
          # For coverage only.
          X, y = make_regression(n_samples=500, random_state=0)
          gbdt = HistGradientBoostingRegressor(loss="absolute_error", random_state=0)
  >       gbdt.fit(X, y)
  
  ..\venv-test\Lib\site-packages\sklearn\ensemble\_hist_gradient_boosting\tests\test_gradient_boosting.py:225: 
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  ..\venv-test\Lib\site-packages\sklearn\base.py:1389: in wrapper
      return fit_method(estimator, *args, **kwargs)
  ..\venv-test\Lib\site-packages\sklearn\ensemble\_hist_gradient_boosting\gradient_boosting.py:663: in fit
      X_binned_train = self._bin_data(X_train, is_training_data=True)
  ..\venv-test\Lib\site-packages\sklearn\ensemble\_hist_gradient_boosting\gradient_boosting.py:1178: in _bin_data
      X_binned = self._bin_mapper.fit_transform(X)  # F-aligned array
  ..\venv-test\Lib\site-packages\sklearn\utils\_set_output.py:319: in wrapped
      data_to_wrap = f(self, X, *args, **kwargs)
  ..\venv-test\Lib\site-packages\sklearn\base.py:918: in fit_transform
      return self.fit(X, **fit_params).transform(X)
  ..\venv-test\Lib\site-packages\sklearn\ensemble\_hist_gradient_boosting\binning.py:234: in fit
      non_cat_thresholds = Parallel(n_jobs=self.n_threads, backend="threading")(
  ..\venv-test\Lib\site-packages\sklearn\utils\parallel.py:82: in __call__
      return super().__call__(iterable_with_config_and_warning_filters)
  ..\venv-test\Lib\site-packages\joblib\parallel.py:2007: in __call__
      return output if self.return_generator else list(output)
  ..\venv-test\Lib\site-packages\joblib\parallel.py:1711: in _get_outputs
      self._terminate_and_reset()
  ..\venv-test\Lib\site-packages\joblib\parallel.py:1386: in _terminate_and_reset
      self._backend.terminate()
  ..\venv-test\Lib\site-packages\joblib\_parallel_backends.py:262: in terminate
      self._pool.close()
  ..\..\..\..\pypa\cibuildwheel\Cache\nuget-cpython\python-freethreaded.3.13.0\tools\Lib\multiprocessing\pool.py:652: in close
      self._change_notifier.put(None)
  ..\..\..\..\pypa\cibuildwheel\Cache\nuget-cpython\python-freethreaded.3.13.0\tools\Lib\multiprocessing\queues.py:394: in put
      self._writer.send_bytes(obj)
  ..\..\..\..\pypa\cibuildwheel\Cache\nuget-cpython\python-freethreaded.3.13.0\tools\Lib\multiprocessing\connection.py:200: in send_bytes
      self._send_bytes(m[offset:offset + size])
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  
  self = <multiprocessing.connection.PipeConnection object at 0x00000243F43267C0>
  buf = <memory at 0x00000243F4C65AC0>
  
      def _send_bytes(self, buf):
          if self._send_ov is not None:
              # A connection should only be used by a single thread
  >           raise ValueError("concurrent send_bytes() calls "
                               "are not supported")
  E           ValueError: concurrent send_bytes() calls are not supported
  
  ..\..\..\..\pypa\cibuildwheel\Cache\nuget-cpython\python-freethreaded.3.13.0\tools\Lib\multiprocessing\connection.py:287: ValueError

Activity

  1. added
    free-threading
    OS:Windows
    Needs Investigation
    on Feb 11, 2025
  2. lesteve commented on May 9, 2025

    @lesteve
    MemberAuthor

    Seems similar to python/cpython#130733. Closing for now since this seems an issue in CPython rather than in scikit-learn.

  3. ogrisel commented on Oct 22, 2025

    @ogrisel
    Member

    I think we should keep this issue open as long as there is no proper fix released either at the joblib or cpython level or a workaround in scikit-learn.

  4. changed the title [-]Windows free-threaded CPython 3.13 ValueError: concurrent send_bytes() calls are not supported[/-] [+]Windows free-threaded ValueError: concurrent send_bytes() calls are not supported[/+] on Oct 22, 2025
  5. changed the title [-]Windows free-threaded ValueError: concurrent send_bytes() calls are not supported[/-] [+]Windows free-threaded Python ValueError: concurrent send_bytes() calls are not supported[/+] on Oct 22, 2025
  6. lesteve commented on Oct 22, 2025

    @lesteve
    MemberAuthor

    For cross-linking purposes, this issue was noticed in Windows arm cp314t two days in a row in the wheels CI: #32393 (comment)

    More info was actually put there as well: #32491 (comment)

  7. ogrisel commented on Oct 23, 2025

    @ogrisel
    Member

    We probably need to debug this at the joblib level. To do so, a working cp314 free-threading CI would help: joblib/joblib#1747

  8. lesteve commented on Oct 23, 2025

    @lesteve
    MemberAuthor

    I am 95% sure this is the CPython issue python/cpython#130733, the stack-traces look extremely similar.

  9. moved this to Todo in Labson Dec 11, 2025
  10. removed their assignment
    on Dec 15, 2025
  11. virchan commented on Sep 18, 2026

    @virchan
    Member

    This happened again in #34977. I re-ran the failed job, and everything is green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds InvestigationOS:Windowsfree-threading

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions