Assertion failed: cannot increment value-initialized deque iterator in thread.cc in M83 and M84

263 views
Skip to first unread message

Samuel Tranchet

unread,
Jul 1, 2020, 2:24:40 PM7/1/20
to discuss-webrtc
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

Alexandre GOUAILLARD

unread,
Jul 1, 2020, 9:45:42 PM7/1/20
to discuss...@googlegroups.com
hi samuel,

you can propose a patch (a CL, change list), following this process:



--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/9dfc789c-7399-420d-a4c0-cc91fcbf7c16n%40googlegroups.com.


--
Alex. Gouaillard, PhD, PhD, MBA
------------------------------------------------------------------------------------
President - CoSMo Software Consulting, Singapore
------------------------------------------------------------------------------------

Samuel Tranchet

unread,
Jul 2, 2020, 11:11:17 AM7/2/20
to discuss-webrtc
Ok great !

I'll work on the fix and try to propose the patch as you show me.

Thanks a lot
Reply all
Reply to author
Forward
0 new messages