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
Cause: data_cond condvar is notified in thread_safe_queue::push without taking head_mutex in the moment when wait_for_data::until already checked m_done and list while keeping head_mutex but not started waiting for notification. A subtle circumstance is race between main thread and api_thread_main. If api_thread_main reaches wait_for_data first, main thread is locked on waiting head_mutex in m_queues[index].empty() check and everything works correctly.
How to reproduce stably: insert sleeps into thread_safe_queue::push and thread_safe_queue::wait_for_data like this:
Hi!
mcut hangs forever in thread_safe_queue.
mcut version: master, b5b0ec6.
Behaviour: in rare cases mcut hangs forever with log like this:
Cause:
data_cond
condvar is notified inthread_safe_queue::push
without takinghead_mutex
in the moment whenwait_for_data::until
already checkedm_done
and list while keepinghead_mutex
but not started waiting for notification. A subtle circumstance is race between main thread andapi_thread_main
. Ifapi_thread_main
reacheswait_for_data
first, main thread is locked on waitinghead_mutex
inm_queues[index].empty()
check and everything works correctly.How to reproduce stably: insert sleeps into
thread_safe_queue::push
andthread_safe_queue::wait_for_data
like this:and then run HelloWorld. You will see:
Fix: lock
head_mutex
before notifyingdata_cond
.The text was updated successfully, but these errors were encountered: