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
When a process is forked (but not exec'd), the child spawns without its parent's threads; which leads to a broken thread pool: whenever any job is executed, we expect the threads to wake up and start picking the tasks -- however, if there are no threads then no tasks are ever executed and the program freezes.
We can guard against this using pthread_atfork() library function.
The text was updated successfully, but these errors were encountered:
This PR introduces two changes to the thread pool:
1. The threads are now initialized lazily, that is on the first run that they are actually required. For example function `get_thread_ids()` will always cause the threads to spawn, whereas `dt::run_parallel()` may not, if the number of rows is small enough to run single-threadedly.
2. Fixed problems with datatable hanging after the process was forked by an external module such as `multiprocessing`. Now we re-initialize the thread pool in every child process, ensuring that they do not accidentally share mutexes / condition variables / threads.
Closes#1758Closes#1757
When a process is forked (but not exec'd), the child spawns without its parent's threads; which leads to a broken thread pool: whenever any job is executed, we expect the threads to wake up and start picking the tasks -- however, if there are no threads then no tasks are ever executed and the program freezes.
We can guard against this using
pthread_atfork()
library function.The text was updated successfully, but these errors were encountered: