Repository navigation
TST Avoid segmentation fault with free-threaded and pytest-run-parallel - #33070
Conversation
|
Good catch. I agree, we need the clone to guarantee correct results in the presence of concurrent test execution. I am a bit worried about the fact that we get a segfault though. We might want to consider wrapping the fit and prediction functions with an instance level lock to protect against segfault, but I am not sure. Alternatively, there might be a way to write the |
I seem to remember that we have seen somewhat similar segfaults with pytest-run-parallel in the tree code before 1, maybe at least a first step would be to clarify the pattern? Having said this I am not too sure using the same instance to fit in parallel would be a very such a common pattern that a user would try. Sure in an ideal world, it would be nice not to segfault. Predicting in parallel, maybe is a more reasonable pattern, like you predict on multiple batches of data in parallel? I don't have a clear intuition how likely Footnotes
|
|
Let's merge this one and deal with the |
(As kind of expected) I can reliably reproduce the segfault with (every single time I tried actually):
Using a
clonefixes it. As we have seen before, the issue is that the parametrized estimators is shared between the pytest-run-parallel threads and you call.fiton it.cc @ogrisel
Output of pytest command