Improved deadlock handling. We will now throw a warning after 1 minute and abort after 5 minutes of inactivity. This may still be too short for FFVideoSource() to finish indexing on extremely large files. Though in this case the user should use 'ffmsindex' to create the index beforehand.
This commit is contained in:
parent
1d5af73ac7
commit
ac5d2c4f89
@ -345,11 +345,11 @@ bool EncodeThread::runEncodingPass(bool x264_x64, bool avs2yuv_x64, bool usePipe
|
|||||||
waitCounter = 0;
|
waitCounter = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(!processEncode.waitForReadyRead(2500))
|
if(!processEncode.waitForReadyRead(m_processTimeoutInterval))
|
||||||
{
|
{
|
||||||
if(processEncode.state() == QProcess::Running)
|
if(processEncode.state() == QProcess::Running)
|
||||||
{
|
{
|
||||||
if(waitCounter++ > m_processTimeoutCounter)
|
if(waitCounter++ > m_processTimeoutMaxCounter)
|
||||||
{
|
{
|
||||||
processEncode.kill();
|
processEncode.kill();
|
||||||
qWarning("x264 process timed out <-- killing!");
|
qWarning("x264 process timed out <-- killing!");
|
||||||
@ -357,6 +357,11 @@ bool EncodeThread::runEncodingPass(bool x264_x64, bool avs2yuv_x64, bool usePipe
|
|||||||
bTimeout = true;
|
bTimeout = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else if(waitCounter == m_processTimeoutWarning)
|
||||||
|
{
|
||||||
|
unsigned int timeOut = (waitCounter * m_processTimeoutInterval) / 1000U;
|
||||||
|
log(tr("Warning: x264 did not respond for %1 seconds, potential deadlock...").arg(QString::number(timeOut)));
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -764,6 +769,8 @@ bool EncodeThread::checkProperties(bool x64, unsigned int &frames)
|
|||||||
unsigned int fSizeW = 0;
|
unsigned int fSizeW = 0;
|
||||||
unsigned int fSizeH = 0;
|
unsigned int fSizeH = 0;
|
||||||
|
|
||||||
|
unsigned int waitCounter = 0;
|
||||||
|
|
||||||
while(process.state() != QProcess::NotRunning)
|
while(process.state() != QProcess::NotRunning)
|
||||||
{
|
{
|
||||||
if(m_abort)
|
if(m_abort)
|
||||||
@ -772,17 +779,30 @@ bool EncodeThread::checkProperties(bool x64, unsigned int &frames)
|
|||||||
bAborted = true;
|
bAborted = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(!process.waitForReadyRead())
|
if(!process.waitForReadyRead(m_processTimeoutInterval))
|
||||||
{
|
{
|
||||||
if(process.state() == QProcess::Running)
|
if(process.state() == QProcess::Running)
|
||||||
|
{
|
||||||
|
if(waitCounter++ > m_processTimeoutMaxCounter)
|
||||||
{
|
{
|
||||||
process.kill();
|
process.kill();
|
||||||
qWarning("Avs2YUV process timed out <-- killing!");
|
qWarning("Avs2YUV process timed out <-- killing!");
|
||||||
log("\nPROCESS TIMEOUT !!!");
|
log("\nPROCESS TIMEOUT !!!");
|
||||||
|
log("\nAvisynth has encountered a deadlock or your script takes EXTREMELY long to initialize!");
|
||||||
bTimeout = true;
|
bTimeout = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else if(waitCounter == m_processTimeoutWarning)
|
||||||
|
{
|
||||||
|
unsigned int timeOut = (waitCounter * m_processTimeoutInterval) / 1000U;
|
||||||
|
log(tr("Warning: Avisynth did not respond for %1 seconds, potential deadlock...").arg(QString::number(timeOut)));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
waitCounter = 0;
|
||||||
|
|
||||||
while(process.bytesAvailable() > 0)
|
while(process.bytesAvailable() > 0)
|
||||||
{
|
{
|
||||||
QList<QByteArray> lines = process.readLine().split('\r');
|
QList<QByteArray> lines = process.readLine().split('\r');
|
||||||
|
@ -79,7 +79,9 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
static QMutex m_mutex_startProcess;
|
static QMutex m_mutex_startProcess;
|
||||||
static const int m_processTimeoutCounter = 24;
|
static const unsigned int m_processTimeoutInterval = 2500;
|
||||||
|
static const unsigned int m_processTimeoutMaxCounter = 120;
|
||||||
|
static const unsigned int m_processTimeoutWarning = 24;
|
||||||
|
|
||||||
//Constants
|
//Constants
|
||||||
const QUuid m_jobId;
|
const QUuid m_jobId;
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#define VER_X264_MAJOR 2
|
#define VER_X264_MAJOR 2
|
||||||
#define VER_X264_MINOR 0
|
#define VER_X264_MINOR 0
|
||||||
#define VER_X264_PATCH 1
|
#define VER_X264_PATCH 1
|
||||||
#define VER_X264_BUILD 119
|
#define VER_X264_BUILD 126
|
||||||
|
|
||||||
#define VER_X264_MINIMUM_REV 2146
|
#define VER_X264_MINIMUM_REV 2146
|
||||||
#define VER_X264_CURRENT_API 120
|
#define VER_X264_CURRENT_API 120
|
||||||
|
Loading…
Reference in New Issue
Block a user