[Qt-interest] QProcess::execute() results in arbitrary "segmenation faults" or "illegal instructions"

Markus Franke Franke.M at sebakmt.com
Thu Jul 1 11:41:45 CEST 2010


Dear all,

I am observing a strange behaviour of the QProcess::execute() function 
resulting in segmentation faults.

I have an object (see sample code below) which installs a timer. The timer 
function is called every 100ms and executes within a loop an external 
process with the help of the QProcess::execute() function.

For a couple of minutes everything is working fine and the processes are 
being executed. But then, at some point in time my whole application 
crashes with a "Segmentation fault" or "Illegal instruction" right before 
or just after the call to QProcess::execute().

I tried to achieve the same behaviour within a simple test application but 
without success. A minimal test example seems to work completely perfect. 

However I am using several threads within my application and when I stop 
all the other threads the code below seems to work again.

Might the segmentation faults maybe have something to do with my 
multithreading application? I mean actually QProcess::execute() should be 
thread-safe. Is there any bug of QProcess within in a multithreaded 
environment known?

I am using Qt Embedded 4.5.0 on an ARM based board.

Thanks for any comments on this,

Markus Franke


---snip---
#include "Page_LanguageUpdate.h"

#include <QProcess>

#define UPDATE_TIMER_MS 100 // refresh view every UPDATE_TIMER_MS 
milliseconds

TPage_LanguageUpdate::TPage_LanguageUpdate(TPageStack *StackLayout, 
TGlobals *GlobalValues, TFileSystem* pFilesystem)
{
}

void TPage_LanguageUpdate::getLanguageUpdates(void)
{
        // allow no parallel executions
        QMutexLocker locker(&UpdateRunningMutex);

        for (int i = 0; i < 10; i++)
                QProcess::execute("ls -l");

        return;
}

void TPage_LanguageUpdate::timerEvent(QTimerEvent* event)
{
        Q_UNUSED(event)

        if(event->timerId() == RefreshTimerID)
                getLanguageUpdates();
        else QWidget::timerEvent(event);
}

void TPage_LanguageUpdate::showEvent(QShowEvent* event)
{
        Q_UNUSED(event)

        DEBUG_TRACE

        RefreshTimerID = startTimer(UPDATE_TIMER_MS);
}

---snap---


"Disclaimer: This message is intended only for the use of the individual 
or entity to
which it is addressed and may contain information which is privileged, 
confidential, proprietary,
or exempt from disclosure under applicable law. If you are not the 
intended recipient or the person
responsible for delivering the message to the intended recipient, you are 
strictly prohibited from
disclosing, distributing, copying, or in any way using this message. If 
you have received this 
communication in error, please notify the sender and destroy and delete 
any copies you may have
received."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100701/e622dd25/attachment.html 


More information about the Qt-interest-old mailing list