Hi everybody, it seems that there is an issue in
ThreadManager::RegisterSendAndCheckForCycles function
from thread.cc file when compiling with MSVC (Visual studio 2019) in debug mode
The problem is happening in debug because of Visual C++ run-time library Debug Iterator Support. It doesn't happend in release mode because the following function is not called when RTC_DCHECK_IS_ON is 0.
void ThreadManager::RegisterSendAndCheckForCycles(Thread* source, Thread* target) {
CritScope cs(&crit_);
std::deque<Thread*> all_targets({target});
// We check the pre-existing who-sends-to-who graph for any path from target
// to source. This loop is guaranteed to terminate because per the send graph
// invariant, there are no cycles in the graph.
for (auto it = all_targets.begin(); it != all_targets.end(); ++it) {
const auto& targets = send_graph_[*it];
------> all_targets.insert(all_targets.end(), targets.begin(), targets.end());
}
RTC_CHECK_EQ(absl::c_count(all_targets, source), 0)
<< " send loop between " << source->name() << " and " << target->name();
// We may now insert source -> target without creating a cycle, since there
// was no path from target to source per the prior CHECK.
send_graph_[source].insert(target);
}
When all_targets.insert is called, the "it" gets invalid because the memory allocation changed in all_targets, so the next ++it generate an assertion failure.
Please note that the host program and the webrtc.lib are compiled with the standard default _ITERATOR_DEBUG_LEVEL = 2
This issue also happened in M83 branch
Does anyone knows what is the purpose of this function, and what is the procedure to follow to propose a fix ? (I'm a C++ developper)
Thanks a lot