I have a pretty simple piece of code that runs QProcess:
launchResultCode = ELaunchOk; QDateTime beginTimeStamp = QDateTime::currentDateTime(); command->start(commandpath, myParameters); if (command->waitForStarted(waitToStart)) { if (!myStdIn.isEmpty()) command->write(myStdIn.toLatin1()); command->closeWriteChannel(); qDebug() << "P1"; if (command->waitForFinished(waitToFinish)) { myStdOut = command->readAllStandardOutput(); myStdErr = command->readAllStandardError(); } else { launchResultCode = ELaunchFinishFailed; } } else { launchResultCode = ELaunchStartFailed; } qDebug() << "postcorrupt";
And this causes a damaged general library error. When I run this code, I get the output from gdb below. I am trying to figure out what is located anywhere in the memory mentioned in the error, but there are no variables! Can someone help me understand what is going wrong here?
(gdb) c Continuing. precorrupt Detaching after fork from child process 21667. P1 warning: Corrupted shared library list: 0x7fffe8008970 != 0x7ffff691b000 postcorrupt [New Thread 0x7fffed453700 (LWP 21668)] Breakpoint 1, RunProcessWorker::run (this=0x7fffffffcc30, whichMutex=RunProcessWorker::EMutexIP, activityID=..., commandFriendlyName=..., commandpath=..., enableDebug=true, showDebugCommandLine=true, debugFilenameTemplate=..., myEnvironment=..., myParameters=..., myStdIn=..., myStdOut=..., myStdErr=..., waitToStart=5000, waitToFinish=5000, actualRunTime=@0x7fffffffca58 : 85, launchResultCode=@0x7fffffffca54 : RunProcessWorker::ELaunchOk, qprocessErrorCode=@0x7fffffffca50 : QProcess::UnknownError, qprocessesExitCode=@0x7fffffffca6c : 0) at ../../src/external-sharedfiles/systemcommands/runprocessworker.cpp:292 292 command->deleteLater(); (gdb) info symbol 0x7fffe8008970 No symbol matches 0x7fffe8008970. (gdb) info symbol 0x7ffff691b000 No symbol matches 0x7ffff691b000. (gdb)
Please note that an error sometimes occurs before my release of P1, so this is something in this area, but I can’t understand that! The forked process is a Qt library, so I cannot see in this library (and probably can not understand it) ... does this mean that this is an error in the Qt library?
Perhaps related, but valgrind shows that memory is lost in the QProcess startup function:
30 (24 direct, 6 indirect) bytes in 1 blocks are definitely lost in loss record 837 of 2,936 in RunProcessWorker::run(RunProcessWorker::EMutex, QString, QString, QString, bool, bool, QString, QStringList, QStringList, QString, QString&, QString&, unsigned int, unsigned int, unsigned long long&, RunProcessWorker::ELaunchResultCodes&, QProcess::ProcessError&, int&) in /mnt/lserver2/data/development/sharedfiles/systemcommands/runprocessworker.cpp:241 1: operator new[](unsigned long) in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so 2: /opt/Qt/5.3/gcc_64/lib/libQt5Core.so.5.3.1 3: /opt/Qt/5.3/gcc_64/lib/libQt5Core.so.5.3.1 4: QProcess::start(QString const&, QStringList const&, QFlags<QIODevice::OpenModeFlag>) in /opt/Qt/5.3/gcc_64/lib/libQt5Core.so.5.3.1