jenkins-bot has submitted this change and it was merged. Change subject: JobRunnerPipeline: get json_decode() error ......................................................................
JobRunnerPipeline: get json_decode() error Some jobs have a status exit of 0 but are still logged as being in error because the result is not an array. I suspect that the job yields an invalid JSON somehow. Capture the PHP json last error number and message whenever json_decode() fails (it returns null) and append them to the error message. Change-Id: I6b308b54ec8dfd7edfe45e605ebcafcd7cf7c935 --- M src/JobRunnerPipeline.php 1 file changed, 6 insertions(+), 1 deletion(-) Approvals: Aaron Schulz: Looks good to me, approved jenkins-bot: Verified diff --git a/src/JobRunnerPipeline.php b/src/JobRunnerPipeline.php index be3f203..7952d10 100755 --- a/src/JobRunnerPipeline.php +++ b/src/JobRunnerPipeline.php @@ -86,13 +86,18 @@ $this->srvc->incrStats( "pop.{$procSlot['type']}.failed.{$host}", $failed ); } else { // Mention any serious errors that may have occured + $extraMessage = ''; + if ( $result === null ) { + $extraMessage = sprintf("json_decode() error (%s): %s\n", + json_last_error(), json_last_error_msg()); + } $cmd = $procSlot['cmd']; $error = $procSlot['stderr'] ?: $procSlot['stdout']; if ( strlen( $error ) > 4096 ) { // truncate long errors $error = mb_substr( $error, 0, 4096 ) . '...'; } $this->srvc->error( "Runner loop $loop process in slot $slot " . - "gave status '{$status['exitcode']}':\n$cmd\n\t$error" ); + "gave status '{$status['exitcode']}':\n$extraMessage$cmd\n\t$error" ); $this->srvc->incrStats( 'runner-status.error', 1 ); } $this->closeRunner( $loop, $slot, $procSlot ); -- To view, visit https://gerrit.wikimedia.org/r/311394 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6b308b54ec8dfd7edfe45e605ebcafcd7cf7c935 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/jobrunner Gerrit-Branch: master Gerrit-Owner: Hashar <has...@free.fr> Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits