Opened 12 years ago

Closed 12 years ago

#4249 closed defect (fixed)

mythfilldatabase segfaulting..

Reported by: damian@… Owned by: Nigel
Priority: critical Milestone: 0.21
Component: mythfilldatabase Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Mythfilldatabase is segfaulting. Do you need a backtrace or is below enough?

damian@mythtv-box:~$ mythfrontend --version Source code version : 15004 SVN Branch : trunk Library API version : 0.21.20071127-1 Network Protocol Version: 36 Options compiled in:

linux release using_oss using_alsa using_arts using_backend using_dvb using_frontend using_ivtv using_joystick_menu using_lirc using_opengl_vsync using_opengl_video using_v4l using_x11 using_xrandr using_xv using_xvmc using_xvmc_opengl using_bindings_perl using_opengl using_xvmc_pbuffer

damian@mythtv-box:~$ mythbackend --version Source code version : 15004 SVN branch : trunk Library API version : 0.21.20071127-1 Network Protocol Version: 36 Options compiled in:

linux release using_oss using_alsa using_arts using_backend using_dvb using_frontend using_ivtv using_joystick_menu using_lirc using_opengl_vsync using_opengl_video using_v4l using_x11 using_xrandr using_xv using_xvmc using_xvmc_opengl using_bindings_perl using_opengl using_xvmc_pbuffer

damian@mythtv-box:~$ mythfilldatabase -v all 2007-11-30 14:18:33.625 Using runtime prefix = /usr/local 2007-11-30 14:18:33.625 Using localhost value of mythtv-box 2007-11-30 14:18:33.626 MCP::DefaultUPnP() - config.xml has default PIN '' and host USN: uuid:785fe75f-4cd9-470e-a19e-223f7feddbc5::urn:schemas-mythtv-org:device:MasterMediaServer:1 2007-11-30 14:18:33.626 Setting UPnP client for backend autodiscovery... 2007-11-30 14:18:33.626 UPnp - Constructor 2007-11-30 14:18:33.627 ThreadPool:AddWorkerThread - HTTP_WorkerThread 2007-11-30 14:18:33.627 UPnp::Initialize - Begin 2007-11-30 14:18:33.627 UPnp::Initialize - Starting TaskQueue? 2007-11-30 14:18:33.627 UPnp::Initialize - Creating SSDP Thread at port 6549 2007-11-30 14:18:33.628 UPnp::Initialize - End 2007-11-30 14:18:33.628 UPnp::Start - Starting SSDP Thread (Multicast) 2007-11-30 14:18:33.628 UPnp::Start - Enabling Notifications 2007-11-30 14:18:33.628 SSDP::EnableNotifications?() - creating new task 2007-11-30 14:18:33.628 SSDP::EnableNotifications?() - sending NTS_byebye 2007-11-30 14:18:33.628 LookupUDN()- bad device type, not enough tokens 2007-11-30 14:18:34.044 SSDP::EnableNotifications?() - sending NTS_alive 2007-11-30 14:18:34.044 SSDP::EnableNotifications?() - Task added to UPnP queue 2007-11-30 14:18:34.044 UPnp::Start - Returning 2007-11-30 14:18:34.181 UPnPconnect() - Trying host at http://192.168.1.100:6544/getDeviceDesc 2007-11-30 14:18:34.182 postHttp: grabbing: http://192.168.1.100:6544/Myth 2007-11-30 14:18:34.183 HttpComms::stateChanged: connecting (2) 2007-11-30 14:18:34.195 HttpComms::stateChanged: sending (3) 2007-11-30 14:18:34.206 HttpComms::stateChanged: reading (4) 2007-11-30 14:18:34.206 Got HTTP response: 200:OK 2007-11-30 14:18:34.206 Keys: accept-ranges,cache-control,connection,content-length,content-type,date,ext,server 2007-11-30 14:18:34.206 HttpComms::stateChanged: connected (5) 2007-11-30 14:18:34.206 done: 759 bytes 2007-11-30 14:18:34.217 Got 759 bytes from url: 'http://192.168.1.100:6544/Myth' 2007-11-30 14:18:34.217 <?xml version="1.0" encoding="utf-8"?> <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetConnectionInfoResponse xmlns:u="urn:schemas-mythtv-org:service:MythTv:1"> <Info>&lt;Database&gt;&lt;Host&gt;localhost&lt;/Host&gt;&lt;Port&gt;0&lt;/Port&gt;&lt;UserName?&gt;mythtv&lt;/UserName?&gt;&lt;Password&gt;muaU8KrQ&lt;/Password&gt;&lt;Name&gt;mythconverg&lt;/Name&gt;&lt;Type&gt;QMYSQL3&lt;/Type&gt;&lt;/Database&gt;&lt;WOL&gt;&lt;Enabled&gt;0&lt;/Enabled&gt;&lt;Reconnect&gt;0&lt;/Reconnect&gt;&lt;Retry&gt;5&lt;/Retry&gt;&lt;Command&gt;echo &apos;WOLsqlServerCommand not set&apos;&lt;/Command&gt;&lt;/WOL&gt;</Info> </u:GetConnectionInfoResponse> </s:Body> </s:Envelope> 2007-11-30 14:18:34.218 UPnPconnect() - Got database hostname: localhost 2007-11-30 14:18:34.226 New DB connection, total: 1 2007-11-30 14:18:34.230 Connected to database 'mythconverg' at host: localhost 2007-11-30 14:18:34.230 Closing DB connection named 'DBManager0' 2007-11-30 14:18:34.230 Clearing Settings Cache. 2007-11-30 14:18:34.230 Deleting UPnP client... 2007-11-30 14:18:34.230 UPnp - Destructor 2007-11-30 14:18:34.231 UPnp::CleanUp?() - disabling SSDP notifications Segmentation fault (core dumped)

Attachments (3)

bt.txt (19.8 KB) - added by anonymous 12 years ago.
Backtrace from mythfilldatabase
debug.patch (2.0 KB) - added by Nigel 12 years ago.
upnptasknotify.cpp debug
mythbackend.log (204.8 KB) - added by eric.bosch@… 12 years ago.
Backend Log after debug.patch is applied

Download all attachments as: .zip

Change History (16)

comment:1 Changed 12 years ago by stuartm

Milestone: unknown0.21
Owner: changed from stuartm to Nigel
Priority: minorcritical
Version: unknownhead

Changed 12 years ago by anonymous

Attachment: bt.txt added

Backtrace from mythfilldatabase

comment:2 Changed 12 years ago by Nigel

I haven't been able to reproduce here, but this patch may help to narrow it down?

Index: upnptasknotify.cpp
===================================================================
--- upnptasknotify.cpp  (revision 15013)
+++ upnptasknotify.cpp  (working copy)
@@ -136,10 +136,18 @@
     // ----------------------------------------------------------------------
 
     UPnpDevice &device = UPnp::g_UPnpDeviceDesc.m_rootDevice;
+    QString     sUDN   = QDeepCopy<QString>(device.GetUDN());
 
-    SendNotifyMsg( pMulticast, "upnp:rootdevice", device.GetUDN() );
-//    SendNotifyMsg( pBroadcast, "upnp:rootdevice", device.GetUDN() );
+    if (sUDN == "uuid:")
+    {
+        VERBOSE(VB_IMPORTANT, "UPnpNotifyTask::Execute() - No root device?");
+        return;
+    }
 
+
+    SendNotifyMsg( pMulticast, "upnp:rootdevice", sUDN );
+//    SendNotifyMsg( pBroadcast, "upnp:rootdevice", sUDN );
+
     // ----------------------------------------------------------------------
     // Process rest of notifications
     // ----------------------------------------------------------------------
Index: ssdp.cpp
===================================================================
--- ssdp.cpp    (revision 15013)
+++ ssdp.cpp    (working copy)
@@ -374,7 +374,7 @@
     QString sMX  = GetHeaderValue( sHeaders, "MX" , "" );
     int     nMX  = 0;
 
-    //cout << "*** SSDP ProcessSearchrequest : [" << sST << "] MX = " << nMX << endl;
+    cout << "*** SSDP ProcessSearchrequest : [" << sST << "] MX = " << nMX << endl;
 
     // ----------------------------------------------------------------------
     // Validate Header Values...

comment:3 Changed 12 years ago by Nigel

(In [15014]) Prevent empty verbose line, eliminate one UPnP error (see #4234. see #4249).

comment:4 Changed 12 years ago by Damian O'Sullivan <damian@…>

15014 has this fixed. Thanks Nigel!

comment:5 Changed 12 years ago by Nigel

Resolution: fixed
Status: newclosed

Cool. There is probably one more bug in UPnpNotifyTask::SendNotifyMsg?(), but for now I will close this

comment:6 Changed 12 years ago by Damian O'Sullivan <damian@…>

Resolution: fixed
Status: closedreopened

Think it might be biting me. Mythfilldatabase seems to work about 50% of the time. The rest it still segfaults.. Want a fresh backtrace?

D.

comment:7 Changed 12 years ago by Nigel

Try this patch first:

Index: upnptasknotify.cpp
===================================================================
--- upnptasknotify.cpp  (revision 15014)
+++ upnptasknotify.cpp  (working copy)
@@ -77,10 +77,10 @@
                             .arg( sUSN         )
                             .arg( m_nMaxAge    );
 
-//    VERBOSE(VB_UPNP, QString("UPnpNotifyTask::SendNotifyMsg : %1 : %2 : %3")
-//                        .arg( pSocket->address().toString() )
-//                        .arg( sNT  )
-//                        .arg( sUSN ));
+    VERBOSE(VB_UPNP, QString("UPnpNotifyTask::SendNotifyMsg : %1 : %2 : %3")
+                        .arg( pSocket->address().toString() )
+                        .arg( sNT  )
+                        .arg( sUSN ));
 
     for ( QStringList::Iterator it  = m_addressList.begin(); 
                                 it != m_addressList.end(); 
@@ -92,6 +92,8 @@
                     "UPnpNotifyTask::SendNotifyMsg - NULL in m_addressList");
             continue;
         }
+        else
+            VERBOSE("UPnpNotifyTask::SendNotifyMsg() - address: " + *it);
 
         QString sHeader = QString( "NOTIFY * HTTP/1.1\r\n"
                                    "HOST: %1:%2\r\n"    
@@ -136,10 +138,18 @@
     // ----------------------------------------------------------------------
 
     UPnpDevice &device = UPnp::g_UPnpDeviceDesc.m_rootDevice;
+    QString     sUDN   = QDeepCopy<QString>(device.GetUDN());
 
-    SendNotifyMsg( pMulticast, "upnp:rootdevice", device.GetUDN() );
-//    SendNotifyMsg( pBroadcast, "upnp:rootdevice", device.GetUDN() );
+    if (sUDN == "uuid:")
+    {
+        VERBOSE(VB_IMPORTANT, "UPnpNotifyTask::Execute() - No root device?");
+        //return;
+    }
 
+
+    SendNotifyMsg( pMulticast, "upnp:rootdevice", sUDN );
+//    SendNotifyMsg( pBroadcast, "upnp:rootdevice", sUDN );
+
     // ----------------------------------------------------------------------
     // Process rest of notifications
     // ----------------------------------------------------------------------

and please provide the -v all output.

Changed 12 years ago by Nigel

Attachment: debug.patch added

upnptasknotify.cpp debug

comment:8 Changed 12 years ago by Damian O'Sullivan <damian@…>

Hope this helps..

damian@mythtv-box:~/SVN/trunk/mythtv$ mythfilldatabase -v all 2007-12-02 12:13:34.020 Using runtime prefix = /usr/local 2007-12-02 12:13:34.020 Using localhost value of mythtv-box 2007-12-02 12:13:34.021 MCP::DefaultUPnP() - config.xml has default PIN '2925' and host USN: uuid:785fe75f-4cd9-470e-a19e-223f7feddbc5::urn:schemas-mythtv-org:device:MasterMediaServer:1 2007-12-02 12:13:34.021 Setting UPnP client for backend autodiscovery... 2007-12-02 12:13:34.021 UPnp - Constructor 2007-12-02 12:13:34.022 ThreadPool:AddWorkerThread - HTTP_WorkerThread 2007-12-02 12:13:34.022 UPnp::Initialize - Begin 2007-12-02 12:13:34.022 UPnp::Initialize - Starting TaskQueue? 2007-12-02 12:13:34.022 UPnp::Initialize - Creating SSDP Thread at port 6549 2007-12-02 12:13:34.023 UPnp::Initialize - End 2007-12-02 12:13:34.023 UPnp::Start - Starting SSDP Thread (Multicast) 2007-12-02 12:13:34.023 UPnp::Start - Enabling Notifications 2007-12-02 12:13:34.023 SSDP::EnableNotifications?() - creating new task 2007-12-02 12:13:34.023 SSDP::EnableNotifications?() - sending NTS_byebye 2007-12-02 12:13:34.023 LookupUDN(urn:schemas-upnp-org:device:MythContextClient:1) sName=UPnP/UDN/MythContextClient, sUDN= 2007-12-02 12:13:34.023 UPnpNotifyTask::SendNotifyMsg? : 239.255.255.250 : upnp:rootdevice : uuid:3a46b26f-37f1-4e62-9075-2990647e4dcf::upnp:rootdevice 2007-12-02 12:13:34.023 UPnpNotifyTask::SendNotifyMsg?() - address: 192.168.1.100 2007-12-02 12:13:34.263 UPnpNotifyTask::SendNotifyMsg? : 239.255.255.250 : uuid:3a46b26f-37f1-4e62-9075-2990647e4dcf : uuid:3a46b26f-37f1-4e62-9075-2990647e4dcf 2007-12-02 12:13:34.263 UPnpNotifyTask::SendNotifyMsg?() - address: 192.168.1.100 2007-12-02 12:13:34.382 UPnpNotifyTask::SendNotifyMsg? : 239.255.255.250 : urn:schemas-upnp-org:device:MythContextClient:1 : uuid:3a46b26f-37f1-4e62-9075-2990647e4dcf::urn:schemas-upnp-org:device:MythContextClient:1 2007-12-02 12:13:34.382 UPnpNotifyTask::SendNotifyMsg?() - address: 192.168.1.100 2007-12-02 12:13:34.615 SSDP::EnableNotifications?() - sending NTS_alive 2007-12-02 12:13:34.615 SSDP::EnableNotifications?() - Task added to UPnP queue 2007-12-02 12:13:34.615 UPnp::Start - Returning 2007-12-02 12:13:34.624 UPnpNotifyTask::SendNotifyMsg? : 239.255.255.250 : upnp:rootdevice : uuid:3a46b26f-37f1-4e62-9075-2990647e4dcf::upnp:rootdevice 2007-12-02 12:13:34.624 UPnpNotifyTask::SendNotifyMsg?() - address: 192.168.1.100 2007-12-02 12:13:34.786 UPnpNotifyTask::SendNotifyMsg? : 239.255.255.250 : uuid:3a46b26f-37f1-4e62-9075-2990647e4dcf : uuid:3a46b26f-37f1-4e62-9075-2990647e4dcf 2007-12-02 12:13:34.787 UPnpNotifyTask::SendNotifyMsg?() - address: 192.168.1.100 2007-12-02 12:13:34.856 Cannot find default UPnP backend 2007-12-02 12:13:34.864 New DB connection, total: 1 2007-12-02 12:13:34.868 Connected to database 'mythconverg' at host: localhost 2007-12-02 12:13:34.869 Closing DB connection named 'DBManager0' 2007-12-02 12:13:34.869 Clearing Settings Cache. 2007-12-02 12:13:34.869 Deleting UPnP client... 2007-12-02 12:13:34.869 UPnp - Destructor 2007-12-02 12:13:34.869 UPnp::CleanUp?() - disabling SSDP notifications 2007-12-02 12:13:34.869 UPnpNotifyTask::SendNotifyMsg? : 239.255.255.250 : upnp:rootdevice : uuid:3a46b26f-37f1-4e62-9075-2990647e4dcf::upnp:rootdevice 2007-12-02 12:13:34.869 UPnpNotifyTask::SendNotifyMsg?() - address: 192.168.1.100 2007-12-02 12:13:34.930 UPnpNotifyTask::SendNotifyMsg? : 239.255.255.250 : uuid:3a46b26f-37f1-4e62-9075-2990647e4dcf : uuid:3a46b26f-37f1-4e62-9075-2990647e4dcf 2007-12-02 12:13:34.930 UPnpNotifyTask::SendNotifyMsg?() - address: 192.168.1.100 Segmentation fault (core dumped)

comment:9 Changed 12 years ago by Damian O'Sullivan <damian@…>

Last output was when backend was not running (Should still not segfault though..). I have included output with backend started..

damian@mythtv-box:~/SVN/trunk/mythtv$ mythfilldatabase -v all 2007-12-02 12:16:59.260 Using runtime prefix = /usr/local 2007-12-02 12:16:59.261 Using localhost value of mythtv-box 2007-12-02 12:16:59.262 MCP::DefaultUPnP() - config.xml has default PIN '2925' and host USN: uuid:785fe75f-4cd9-470e-a19e-223f7feddbc5::urn:schemas-mythtv-org:device:MasterMediaServer:1 2007-12-02 12:16:59.262 Setting UPnP client for backend autodiscovery... 2007-12-02 12:16:59.262 UPnp - Constructor 2007-12-02 12:16:59.262 ThreadPool:AddWorkerThread - HTTP_WorkerThread 2007-12-02 12:16:59.262 UPnp::Initialize - Begin 2007-12-02 12:16:59.262 UPnp::Initialize - Starting TaskQueue? 2007-12-02 12:16:59.263 UPnp::Initialize - Creating SSDP Thread at port 6549 2007-12-02 12:16:59.263 UPnp::Initialize - End 2007-12-02 12:16:59.263 UPnp::Start - Starting SSDP Thread (Multicast) 2007-12-02 12:16:59.263 UPnp::Start - Enabling Notifications 2007-12-02 12:16:59.263 SSDP::EnableNotifications?() - creating new task 2007-12-02 12:16:59.263 SSDP::EnableNotifications?() - sending NTS_byebye 2007-12-02 12:16:59.263 LookupUDN(urn:schemas-upnp-org:device:MythContextClient:1) sName=UPnP/UDN/MythContextClient, sUDN= 2007-12-02 12:16:59.264 UPnpNotifyTask::SendNotifyMsg? : 239.255.255.250 : upnp:rootdevice : uuid:782bb106-72bb-412f-aff7-f09f1892c1a6::upnp:rootdevice 2007-12-02 12:16:59.264 UPnpNotifyTask::SendNotifyMsg?() - address: 192.168.1.100 2007-12-02 12:16:59.447 UPnpNotifyTask::SendNotifyMsg? : 239.255.255.250 : uuid:782bb106-72bb-412f-aff7-f09f1892c1a6 : uuid:782bb106-72bb-412f-aff7-f09f1892c1a6 2007-12-02 12:16:59.447 UPnpNotifyTask::SendNotifyMsg?() - address: 192.168.1.100 2007-12-02 12:16:59.586 UPnpNotifyTask::SendNotifyMsg? : 239.255.255.250 : urn:schemas-upnp-org:device:MythContextClient:1 : uuid:782bb106-72bb-412f-aff7-f09f1892c1a6::urn:schemas-upnp-org:device:MythContextClient:1 2007-12-02 12:16:59.586 UPnpNotifyTask::SendNotifyMsg?() - address: 192.168.1.100 2007-12-02 12:16:59.729 SSDP::EnableNotifications?() - sending NTS_alive 2007-12-02 12:16:59.730 SSDP::EnableNotifications?() - Task added to UPnP queue 2007-12-02 12:16:59.730 UPnp::Start - Returning 2007-12-02 12:16:59.765 UPnpNotifyTask::SendNotifyMsg? : 239.255.255.250 : upnp:rootdevice : uuid:782bb106-72bb-412f-aff7-f09f1892c1a6::upnp:rootdevice 2007-12-02 12:16:59.765 UPnpNotifyTask::SendNotifyMsg?() - address: 192.168.1.100 2007-12-02 12:16:59.882 Cannot find default UPnP backend 2007-12-02 12:16:59.890 New DB connection, total: 1 2007-12-02 12:16:59.892 UPnpNotifyTask::SendNotifyMsg? : 239.255.255.250 : uuid:782bb106-72bb-412f-aff7-f09f1892c1a6 : uuid:782bb106-72bb-412f-aff7-f09f1892c1a6 2007-12-02 12:16:59.892 UPnpNotifyTask::SendNotifyMsg?() - address: 192.168.1.100 2007-12-02 12:16:59.894 Connected to database 'mythconverg' at host: localhost 2007-12-02 12:16:59.895 Closing DB connection named 'DBManager0' 2007-12-02 12:16:59.895 Clearing Settings Cache. 2007-12-02 12:16:59.895 Deleting UPnP client... 2007-12-02 12:16:59.895 UPnp - Destructor 2007-12-02 12:16:59.895 UPnp::CleanUp?() - disabling SSDP notifications 2007-12-02 12:16:59.895 UPnpNotifyTask::SendNotifyMsg? : 239.255.255.250 : upnp:rootdevice : uuid:782bb106-72bb-412f-aff7-f09f1892c1a6::upnp:rootdevice 2007-12-02 12:16:59.895 UPnpNotifyTask::SendNotifyMsg?() - address: 192.168.1.100 2007-12-02 12:17:00.003 UPnpNotifyTask::SendNotifyMsg? : 239.255.255.250 : uuid:782bb106-72bb-412f-aff7-f09f1892c1a6 : uuid:782bb106-72bb-412f-aff7-f09f1892c1a6 2007-12-02 12:17:00.003 UPnpNotifyTask::SendNotifyMsg?() - address: 192.168.1.100 2007-12-02 12:17:00.072 UPnpNotifyTask::SendNotifyMsg?() - address: ?????? 2007-12-02 12:17:00.077 UPnpNotifyTask::SendNotifyMsg? : 239.255.255.250 : urn:schemas-upnp-org:device:MythContextClient:1 : uuid:782bb106-72bb-412f-aff7-f09f1892c1a6::urn:schemas-upnp-org:device:MythContextClient:1 2007-12-02 12:17:00.077 UPnpNotifyTask::SendNotifyMsg?() - address: 192.168.1.100 Segmentation fault (core dumped)

Changed 12 years ago by eric.bosch@…

Attachment: mythbackend.log added

Backend Log after debug.patch is applied

comment:10 Changed 12 years ago by eric.bosch@…

I just uploaded the backend log file. Mythbackend crashes about 20-30% of the time. Random segfaults occur on many if not all functions, including mythmusic, mythbrowser. In the log file, there are 3-4 successful startups, and the last one is in crashed state.

comment:11 Changed 12 years ago by Nigel

Thanks for all the logs - that is enough to keep me scratching my head for a while.

Until I can reproduce/repair, just deleteing the config.xml file should disable the UPnP stuff, and get you working reliably (assuming that mysql.txt is valid).

comment:12 Changed 12 years ago by Nigel

(In [15020]) Work around random segfaults in UPnpNotifyTask::Execute() when disabling SSDP notifications. See #4234. See #4249. It seems that m_addressList has some bad values (not NULL, but not valid QStr). Suspect QString thread problem, but a QDeepCopy of the string or the stringlist does nothing. Deleting the threads before the SSDP object seems safe.

comment:13 Changed 12 years ago by Nigel

Resolution: fixed
Status: newclosed

I am hoping that the fix in #4301, which was applied in [15184], completely fixes the original problem, and any new ones that I introduced in [15020]. If not, please open a new ticket - this one is too busy to follow.

Note: See TracTickets for help on using tickets.