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
Tests test_theil_sen_parallel and test_multi_output_classification_partial_fit_parallelism hang on Windows #12263
Could you also install pytest-timeout in your env and add the option -s --timeout=10 to your call to pytest. This way we will have more info on why this is stucked.
It is weird that the test passes on appveyor if you see a deterministic failure on your machine.
>pytest -s --timeout=10 -v --pyarg sklearn.linear_model.tests.test_theil_sen::test_theil_sen_parallel
Exception in thread QueueManagerThread:
File "<<elided>>\lib\site-packages\sklearn\externals\joblib\externals\loky\process_executor.py", line 617, in _queue_management_worker
ready = wait(readers + worker_sentinels)
File "<<elided>>\lib\multiprocessing\connection.py", line 859, in wait
File "<<elided>>\lib\multiprocessing\connection.py", line 791, in _exhaustive_wait
res = _winapi.WaitForMultipleObjects(L, False, timeout)
ValueError: need at most 63 handles, got a sequence of length 129
<< lots of warnings suppressed >>
+++++++++++++++++++++++++++++++++++ Timeout ++++++++++++++++++++++++++++++++++++
~~~~~~~~~~~~~~~~~~~~~~ Stack of QueueFeederThread (22640) ~~~~~~~~~~~~~~~~~~~~~~
File "<<elided>>\lib\site-packages\sklearn\externals\joblib\externals\loky\backend\queues.py", line 138, in _feed
nwait()
File "<<elided>>\lib\threading.py", line 295, in wait
waiter.acquire()
~~~~~~~~~~~~~~~~~~~~~~~~~ Stack of MainThread (24148) ~~~~~~~~~~~~~~~~~~~~~~~~~~
testfunction(**testargs)
File "<elided>\lib\site-packages\sklearn\linear_model\tests\test_theil_sen.py", line 267, in test_theil_sen_parallel
max_subpopulation=2e3).fit(X, y)
File "<elided>\site-packages\sklearn\linear_model\theil_sen.py", line 390, in fit
for job in range(n_jobs))
File "<<elided>>\lib\site-packages\sklearn\externals\joblib\parallel.py", line 996, in __call__
self.retrieve()
File "<<elided>>\lib\site-packages\sklearn\externals\joblib\parallel.py", line 899, in retrieve
self._output.extend(job.get(timeout=self.timeout))
File "<<elided>>\lib\site-packages\sklearn\externals\joblib\_parallel_backends.py", line 517, in wrap_future_result
return future.result(timeout=timeout)
File "<<elided>>\lib\concurrent\futures\_base.py", line 427, in result
self._condition.wait(timeout)
File "<<elided>>\lib\threading.py", line 295, in wait
waiter.acquire()
+++++++++++++++++++++++++++++++++++ Timeout ++++++++++++++++++++++++++++++++++++
It looks like you are missing a part of the trace in QueueManagerThread.
Can you confirm that we can see all the trace or update it? (the first line should show the _queue_management_worker function first.)
I have tried on a big Dual Intel Xeon E5-2660 v3 running Windows 2012 and scikit-learn 0.20.0 installed from pip in a dedicated conda env exactly as reported by @oleksandr-pavlyk and I could not reproduce the hangs. I repeated the pytest commands more than 20 times and each completed successfully in less than 2s. And I could see in the task manager than many cores were used. I also launched the full test suite successfully.
I tried also to build scikit-learn master and launch the full test suite twice and it completed without any hang. There are failing doctests under windows but this is expected (the way the default dtype of integer arrays is printed in doctest output is not necessarily always consistent with the output under other platforms but this is harmless).
@ogrisel@jnothman Please allow me a moment to build it and run the test. I would report in about one hour (expected build + test run time on our server)
If you built the master branch then the problem is still there. This is weird because I could not reproduce the issue, neither on 0.20.0 nor on master.
Is there a way for me to access prebuilt wheels, or other binaries that you used to check whether the problem is fixed?
We got bit by another one of these parallel tests, namely sklearn/decomposition/tests/test_dict_learning.py::test_dict_learning_reconstruction_parallel.
At the same time, the test sklearn/decomposition/tests/test_dict_learning.py::test_sparse_coder_parallel_mmap runs fine.
The difference between them is that the hanging one sets n_jobs=-1, while the working one is explicit n_jobs=2.
If you think it is a good idea to be explicit about the number of jobs in test suite (say n_job 4 or less), I would open a PR. Please let me know.
Activity
amueller commentedon Oct 3, 2018
Thank you for reporting! That's not great :-/
tomMoral commentedon Oct 5, 2018
Could you also install
pytest-timeoutin your env and add the option-s --timeout=10to your call topytest. This way we will have more info on why this is stucked.It is weird that the test passes on appveyor if you see a deterministic failure on your machine.
oleksandr-pavlyk commentedon Oct 5, 2018
Here is what I see:
tomMoral commentedon Oct 5, 2018
It looks like you are missing a part of the trace in
QueueManagerThread.Can you confirm that we can see all the trace or update it? (the first line should show the
_queue_management_workerfunction first.)oleksandr-pavlyk commentedon Oct 5, 2018
@tomMoral Yes, my bad. I have updated the earlier comment to include the said line.
tomMoral commentedon Oct 5, 2018
How many workers do you have here? Are you on a server with more than 127 cores?
oleksandr-pavlyk commentedon Oct 5, 2018
The machine has Intel Xeon E5-2630 v3, with 2 sockets, 8 cores per socket, HT: 2. The task manager reports 16 cores, and 32 logical cores.
When the test run hangs I do indeed see over 100 python processes in the task manager.
jnothman commentedon Nov 11, 2018
@oleksandr-pavlyk could you clarify whether this is resolved in master after c81e255?
ogrisel commentedon Nov 12, 2018
I am starting a rackspace VM under windows to give it a try.
ogrisel commentedon Nov 12, 2018
I have tried on a big Dual Intel Xeon E5-2660 v3 running Windows 2012 and scikit-learn 0.20.0 installed from pip in a dedicated conda env exactly as reported by @oleksandr-pavlyk and I could not reproduce the hangs. I repeated the pytest commands more than 20 times and each completed successfully in less than 2s. And I could see in the task manager than many cores were used. I also launched the full test suite successfully.
I tried also to build scikit-learn master and launch the full test suite twice and it completed without any hang. There are failing doctests under windows but this is expected (the way the default dtype of integer arrays is printed in doctest output is not necessarily always consistent with the output under other platforms but this is harmless).
oleksandr-pavlyk commentedon Nov 12, 2018
@ogrisel @jnothman Please allow me a moment to build it and run the test. I would report in about one hour (expected build + test run time on our server)
oleksandr-pavlyk commentedon Nov 12, 2018
I can still see the hang with a local build from current master (4e81949).
Upon execution of
There are 130 idle Python processes shown in task manager and the execution never terminates.
Pressing Ctrl+C terminates all 130 processes, which is an improvement over an earlier version of joblib.
Is there a way for me to access prebuilt wheels, or other binaries that you used to check whether the problem is fixed?
Thanks!
ogrisel commentedon Nov 13, 2018
If you built the master branch then the problem is still there. This is weird because I could not reproduce the issue, neither on 0.20.0 nor on master.
Our CI uploads the wheels built on the master branch for 64 bit Python 3.7 and 32 bit Python 2.7 on the following rackspace blob storage:
http://bc1c050a9b3a9f5bf3f5-965058070168eb2f1b8f5a23def30e14.r96.cf2.rackcdn.com/
But they should yield the same result as the one you observed by building the master branch yourself.
oleksandr-pavlyk commentedon Nov 14, 2018
Thanks @ogrisel . I downloaded and installed
scikit_learn-0.21.dev0+20181114100605-cp37-cp37m-win_amd64.whland can still reproduce the hang.22 remaining items
oleksandr-pavlyk commentedon Apr 11, 2019
We got bit by another one of these parallel tests, namely
sklearn/decomposition/tests/test_dict_learning.py::test_dict_learning_reconstruction_parallel.At the same time, the test
sklearn/decomposition/tests/test_dict_learning.py::test_sparse_coder_parallel_mmapruns fine.The difference between them is that the hanging one sets
n_jobs=-1, while the working one is explicitn_jobs=2.If you think it is a good idea to be explicit about the number of jobs in test suite (say
n_job4 or less), I would open a PR. Please let me know.jnothman commentedon Apr 14, 2019
MAINT: n_jobs=-1 replaced with n_jobs=4 in tests
MAINT: n_jobs=-1 replaced with n_jobs=4 in tests (#13644)
MAINT: n_jobs=-1 replaced with n_jobs=4 in tests (scikit-learn#13644)
MAINT: n_jobs=-1 replaced with n_jobs=4 in tests (scikit-learn#13644)
MAINT: n_jobs=-1 replaced with n_jobs=4 in tests (scikit-learn#13644)
adrinjalali commentedon Apr 20, 2020
It seems this issue is fixed? Closing, please feel free to reopen if it's still an issue.