Issue Bug Closed

#69157scheduler serializes complete exception on task failure

Stephan Großberndt 08/18/15, 16:08 updated 10/02/18, 11:34

Description

If a task in scheduler fails it does not throw an exception but tries to log it to sys_log.

It logs the complete Exception by serializing it:

if ($failure instanceof \Exception) {
    // Log failed execution
    $logMessage = 'Task failed to execute successfully. Class: ' . get_class($this) . ', UID: ' . $this->taskUid . '. ' . $failure->getMessage();
    $this->scheduler->log($logMessage, 1, $failure->getCode());
    $failure = serialize($failure);
} else {
    $failure = '';
}
// Save the updated executions list
$GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_scheduler_task', 'uid = ' . $this->taskUid, array(
    'serialized_executions' => $runningExecutionsSerialized,
    'lastexecution_failure' => $failure
));

This often leads to HUGE strings (I had one case with 53MB!!). If this exceeds mysqls max_allowed_packet (default 16MB) mysql kills the connection resulting in “mysql server has gone away”

Instead of serializing and logging the complete exception only relevant parts (all but Exception->getTrace) should be logged.

Reviews 2