MythTV/mythtv

Mythbackend crash v35-pre

Closed this issue · 6 comments

  • Platform: Ubuntu 22.04.5 LTS (GNU/Linux 6.6.4 x86_64)

  • MythTV version: v35-pre, latest master 8258345

  • Package version: self compiled

  • Component: Mythbackend

What steps will reproduce the bug?

I had three crashes, one after some 10 minutes , 80 minutes and after 3 minutes. Thereafter it crashes immediately.
Recording has been working. But it seems at some point it crashes when starting a recording, and now after restart it wants to start a recording immediately and crashes.

EDIT: see next comment for logs and stack trace

It is like I said, DVB recording works, IPTV/UDP fails.
See attached logs and stack trace.
mythbackend_crash_20241020_001.zip

Do you happen to know the last MythTV version where it was still working OK?
OK this was August, you did mention this in #936 .
Question: exactly what did you use as signal source for this?
Looks to me like all IPTV channels I did test use http(s) or am I missing something?
It would be great if I can reproduce this.
If that is difficult, can you please provide a traceback from a build with debug?

I bisected the issue:

816a46d13ac7267a9fbacdc2131ccb4cf68f88a1 is the first bad commit
commit 816a46d13ac7267a9fbacdc2131ccb4cf68f88a1
Author: David Hampton <mythtv@love2code.net>
Date:   Sun Jul 28 09:44:01 2024 -0400

    tidy: Use const reference for local variables when possible. (libs)

    Finds local variable declarations that are initialized using the copy
    constructor of a non-trivially-copyable type but it would suffice to
    obtain a const reference.

    All changes made by clang-tidy.

    https://clang.llvm.org/extra/clang-tidy/checks/performance/unnecessary-copy-initialization.html

 mythtv/libs/libmyth/standardsettings.cpp                                   | 2 +-
 mythtv/libs/libmyth/storagegroupeditor.cpp                                 | 4 ++--
 mythtv/libs/libmythbase/housekeeper.cpp                                    | 4 ++--
 mythtv/libs/libmythbase/http/mythwebsocketevent.cpp                        | 2 +-
 mythtv/libs/libmythbase/mythmiscutil.cpp                                   | 2 +-
 mythtv/libs/libmythbase/test/test_mythbinaryplist/test_mythbinaryplist.cpp | 2 +-
 mythtv/libs/libmythprotoserver/requesthandler/basehandler.cpp              | 4 ++--
 mythtv/libs/libmythprotoserver/requesthandler/fileserverhandler.cpp        | 2 +-
 mythtv/libs/libmythprotoserver/requesthandler/messagehandler.cpp           | 4 ++--
 mythtv/libs/libmythtv/HLS/httplivestreambuffer.cpp                         | 2 +-
 mythtv/libs/libmythtv/HLS/m3u.cpp                                          | 2 +-
 mythtv/libs/libmythtv/jobqueue.cpp                                         | 2 +-
 mythtv/libs/libmythtv/overlays/mythchanneloverlay.cpp                      | 2 +-
 mythtv/libs/libmythtv/overlays/mythnavigationoverlay.cpp                   | 2 +-
 mythtv/libs/libmythtv/recorders/rtp/packetbuffer.cpp                       | 2 +-
 mythtv/libs/libmythtv/transporteditor.cpp                                  | 2 +-
 mythtv/libs/libmythtv/tv_play.cpp                                          | 2 +-
 mythtv/libs/libmythtv/videosource.cpp                                      | 4 ++--
 mythtv/libs/libmythui/mythdialogbox.cpp                                    | 4 ++--
 mythtv/libs/libmythui/mythnotificationcenter.cpp                           | 2 +-
 mythtv/libs/libmythui/mythprogressdialog.cpp                               | 4 ++--
 mythtv/libs/libmythui/mythscreentype.cpp                                   | 2 +-
 mythtv/libs/libmythui/myththemedmenu.cpp                                   | 2 +-
 mythtv/libs/libmythui/mythuibutton.cpp                                     | 2 +-
 mythtv/libs/libmythui/mythuibuttonlist.cpp                                 | 4 ++--
 mythtv/libs/libmythui/mythuibuttontree.cpp                                 | 2 +-
 mythtv/libs/libmythui/mythuicheckbox.cpp                                   | 2 +-
 mythtv/libs/libmythui/mythuitextedit.cpp                                   | 2 +-
 mythtv/libs/libmythui/mythuiwebbrowser.cpp                                 | 6 +++---
 mythtv/libs/libmythui/mythvirtualkeyboard.cpp                              | 2 +-
 mythtv/libs/libmythui/platforms/mythscreensaverdbus.cpp                    | 2 +-
 mythtv/libs/libmythupnp/upnpcds.cpp                                        | 4 ++--
 mythtv/libs/libmythupnp/websocket.cpp                                      | 2 +-
 mythtv/libs/libmythupnp/xsd.cpp                                            | 2 +-
 34 files changed, 45 insertions(+), 45 deletions(-)

On current master 3f6def5 the following fixed the issue:

commit d650852c5f0f68cdf3f1efb1815b0f103db673b9 (HEAD -> master)
Author: angelaschmid <angela.schmid@wolke7.net>
Date:   Tue Nov 26 00:36:48 2024 +0100

    FIX: udp crash

diff --git a/mythtv/libs/libmythtv/recorders/rtp/packetbuffer.cpp b/mythtv/libs/libmythtv/recorders/rtp/packetbuffer.cpp
index 0346157e09..247e8c4af3 100644
--- a/mythtv/libs/libmythtv/recorders/rtp/packetbuffer.cpp
+++ b/mythtv/libs/libmythtv/recorders/rtp/packetbuffer.cpp
@@ -40,7 +40,7 @@ UDPPacket PacketBuffer::GetEmptyPacket(void)
         return UDPPacket(m_next_empty_packet_key++);
     }

-    const UDPPacket& packet(*it);
+    UDPPacket packet(*it);
     m_empty_packets.erase(it);

     return packet;

Maybe there exist other issues with the bad commit.

Yet another one of the clang-tidy introduced bugs... many thanks for bisecting and fixing.
Will be committed soon.

@angelaschmid can you please check if the issue is really solved now? If so, then feel free to close the ticket.

No issues since 5 days. Thanks for adding the patch.