Opened 11 years ago

Closed 7 years ago

#11795 closed Bug Report - Crash (Won't Fix)

Random crash in MythSystemLegacy

Reported by: kevin@… Owned by:
Priority: major Milestone: 0.27.7
Component: MythTV - General Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

I'm getting a crash in mythbackend about once or twice a day, usually after the backend runs my external channel change script. The backtrace is:

#0  0xb39a0ede in QSemaphore::release(int) ()
   from /usr/lib/i386-linux-gnu/libQtCore.so.4
#1  0xb5d78534 in MythSystemLegacy::Unlock (this=0x0) at mythsystemlegacy.h:160
#2  0xb5d786aa in MythSystemLegacyPrivate::Unlock (this=0x9cdd17b8)
    at mythsystemprivate.h:72
#3  0xb5d74e5a in MythSystemLegacySignalManager::run (this=0xac122930)
    at mythsystemunix.cpp:559
#4  0xb5c784fc in MThreadInternal::run (this=0xac13bd30) at mthread.cpp:79
#5  0xb39a4f00 in ?? () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#6  0xb4bb3c39 in start_thread ()
   from /lib/i386-linux-gnu/i686/cmov/libpthread.so.0
#7  0xb377a78e in clone () from /lib/i386-linux-gnu/i686/cmov/libc.so.6

As you can see on line #1, "this" is null. Here's the section of code in question (actually it's from line #2 above):

    void Unlock(void)                { m_parent->Unlock(); }

Here "m_parent" is null. If we go up one call frame, we have:

            if (ms->m_parent)
            {
                if (ms->GetStatus() == GENERIC_EXIT_OK)
                    emit ms->finished();
                else
                    emit ms->error(ms->GetStatus());

                ms->disconnect();
                ms->Unlock();
            }

So sometime between the check for m_parent being null, and calling "ms->Unlock", m_parent does become null. Since m_parent is a QPointer, if code on another thread somewhere deletes what m_parent is pointing to, then m_parent will become a null pointer, rather than pointing into deleted memory.

Since this is running in a separate thread, I'm thinking another thread is deleting the parent MythSystemLegacy object before the signal manager thread is done with it.

I haven't had time to further track this down, but I wanted to file this in case the resident expert (whoever that may be) of MythSystem might know exactly where the problem is.

Thanks! -- Kevin

Change History (9)

comment:1 Changed 11 years ago by stuartm

Milestone: unknown0.27
Priority: minorblocker

comment:2 Changed 11 years ago by stuartm

Owner: set to stuartm
Status: newaccepted

comment:3 Changed 11 years ago by Stuart Morgan <smorgan@…>

In 9059c42eab34bcdaa160afa988ed99c4ae30dbaa/mythtv:

Prevent a segfault in MythSystemLegacyPrivate?. This is just a hack to avoid the crash until we can figure out the root cause. Refs #11795

comment:4 Changed 11 years ago by Stuart Morgan <smorgan@…>

In 3787c76146fc08d24b8a0a896a7de8dcebbf3634/mythtv:

Prevent a segfault in MythSystemLegacyPrivate?. This is just a hack to avoid the crash until we can figure out the root cause. Refs #11795
(cherry picked from commit 9059c42eab34bcdaa160afa988ed99c4ae30dbaa)

comment:5 Changed 11 years ago by stuartm

Milestone: 0.270.27.1
Owner: changed from stuartm to danielk
Priority: blockermajor
Status: acceptedassigned

comment:6 Changed 9 years ago by Stuart Auchterlonie

Milestone: 0.27.20.27.6

comment:7 Changed 9 years ago by Karl Egly

Owner: danielk deleted
Status: assignednew

comment:8 Changed 9 years ago by Karl Egly

Milestone: 0.27.60.27.7

Reschedule all tickets planned for, but not solved in time for, 0.27.6 to 0.27.7.

comment:9 Changed 7 years ago by Stuart Auchterlonie

Resolution: Won't Fix
Status: newclosed

Closing any remaining open tickets for 0.27

If the issue still persists, feel free to reopen and align to a current release (v29 or master)

Note: See TracTickets for help on using tickets.