Opened 18 years ago

Closed 18 years ago

#1173 closed defect (fixed)

thread leak in PreviewGenerator

Reported by: jwestfall@… Owned by: danielk
Priority: minor Milestone: 0.19
Component: mythtv Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Hi

so my backend is currently up to 33 threads. Most of which appear to be the previewgenerator thread which is fired off after each recording. I think the following code is the problem.

void PreviewGenerator::TeardownAll(void)
{
    const QString filename = programInfo.pathname + ".png";

    MythTimer t;
    t.start();
    for (bool done = false; !done;)
    {
        previewLock.lock();
        if (isConnected)
            emit previewThreadDone(filename, done);
        else
            done = true;
        previewLock.unlock();
        usleep(5000);
    }
    VERBOSE(VB_PLAYBACK, LOC + "previewThreadDone took "<<t.elapsed()<<"ms");
    disconnectSafe();
}

isConnected is set to true in the constructor and only gets set to false as part of disconnectSafe(). There is no way for the for loop to exit because of this.

Change History (2)

comment:1 Changed 18 years ago by danielk

Owner: changed from Isaac Richards to danielk

comment:2 Changed 18 years ago by danielk

Resolution: fixed
Status: newclosed

(In [8813]) Fixes #1173. References #1147.

This fixes #1173: isConnected should default to false, not true...

This also disables threading for the preview generator in the PlaybackBox?, which prevents the segfault in #1147. If someone wants the threading, just uncomment the USE_PRED_GEN_THREAD define in playbackbox.cpp.

Note: See TracTickets for help on using tickets.