Hi,
I think I found a bug when using the notebook and rayon features at the same time.
This snippet seems to cause a deadlock.
#[pyfunction]
fn my_function(something: &[u8]) {
kdam::set_notebook(true);
kdam::par_tqdm!(something.par_iter()).something();
}
When calling this function inside a jupyter notebook, it just hang indefinitely.
Workarounds
Turning off notebook mode works but defeats the purpose.
Wrapping the iteration inside a py.allow_threads(|| ...) seems to also resolve the issue.
However in this sort of notebook workflow you often iterate over things that come from python, so not holding the GIL during the entire function is often wrong and could result in unexpected memory races.
Hi,
I think I found a bug when using the
notebookandrayonfeatures at the same time.This snippet seems to cause a deadlock.
When calling this function inside a jupyter notebook, it just hang indefinitely.
Workarounds
Turning off notebook mode works but defeats the purpose.
Wrapping the iteration inside a
py.allow_threads(|| ...)seems to also resolve the issue.However in this sort of notebook workflow you often iterate over things that come from python, so not holding the GIL during the entire function is often wrong and could result in unexpected memory races.