#461 Memory leak: m_outOfOrderPackets continuously increases

Development_Branch
closed-fixed
nobody
None
5
2014-04-02
2013-06-28
No

There are cases when OpalRTPSession::m_outOfOrderPackets list can contain too much packets (more than 5000 packets) - these sessions use all process memory.
Anyway most of these packets are out-of-time already so we don't need to keep all of them.

Discussion

  • I am mystified on how this can happen. It is certainly not intentional. Not unless you got 5000 packets inside 100ms! Which seems unlikely.

    Can I get a log file?

     
  • I'll send you a log file when I get this issue again.

     
  • I've sent you a log file.

     
  • The bug exists because of this line:

    outOfOrderPacketTime = tick;

    in OpalRTPSession::OnReceiveData after switching the packet to the first available in m_outOfOrderPackets collection.

    So when that switching occurs then "outOfOrderPacketTime" has a value of the currently received packet time and the next packets (in next 100 milliseconds) hit the outOfOrderWaitTime interval:

    else if (resequenceOutOfOrderPackets &&
                (m_outOfOrderPackets.empty() || (tick - outOfOrderPacketTime) < outOfOrderWaitTime)) {
    

    and they are added to the "m_outOfOrderPackets".

    After the 100ms, we pull out a next packet from "m_outOfOrderPackets", update outOfOrderPacketTime and add next 100ms packets to the "m_outOfOrderPackets".

    This is how the memory overflow occurs.

     
  • Patch #270 fixes this.

     
    • status: open --> closed-fixed