Repository navigation
Conversation
…troyed The send thread waits on a std::condition_variable, which is not a boost::thread interruption point, so interrupt() in the destructor never woke it. Once the channel stopped delivering frames, join() waited forever and the server could not shut down. The destructor now sets a stop flag under the buffer mutex and notifies the thread, and both waits return on it.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Problem
A channel with an NDI consumer hangs on shutdown.
~newtek_ndi_consumer()callssend_thread.interrupt()and thenjoin(), but the send thread spends its time inworker_cond_.wait(...)on astd::condition_variable. That is not aboost::threadinterruption point, so the interrupt never wakes it. Once the channel stops delivering frames (as it does while shutting down), nothing notifies the condition variable again andjoin()waits forever.Seen on a Windows playout server (2.5.0, six channels, NDI on one of them): every
KILLstopped atvideo_channel[6] Uninitializingand the process had to be terminated. DeckLink on the same channel never got toScheduled playback has stopped, because the NDI consumer (index 900) is torn down before it.Fix
The destructor sets a
stopping_flag underbuffer_mutex_and callsnotify_all()before the existinginterrupt()/join(). Both waits in the send thread include the flag in their predicate and return when it is set. Behaviour while running is unchanged.Testing
Applied to the same code on 2.5.0-stable and deployed on that server:
KILLnow completes in about 5 s, withndi_consumer[6|MV] Uninitialized, the screen and DeckLink consumers on that channel uninitialised in turn, andSuccessfully shutdown CasparCG Server.This branch also builds on Windows and on Linux (system dependencies) with the repository's workflows.