Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,17 @@ private static class WriteLog extends MasterToSlaveFileCallable<Long> {
// TODO would be more efficient to allow API to consolidate writeLog with exitStatus (save an RPC call)
@Override public Integer exitStatus(FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException {
FilePath status = getResultFile(workspace);
if (status.exists()) {
if (status.exists() && status.length() > 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this alone would fix the issue, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theoretically, yes, if there's no bogus whitespace or other stuff in there.

try {
return Integer.parseInt(status.readToString().trim());
} catch (NumberFormatException x) {
throw new IOException("corrupted content in " + status + ": " + x, x);
LOGGER.log(Level.FINE, "Unable to parse exit code file, waiting briefly and retrying - file "+status+" error message: "+x.getMessage());
try {
Thread.sleep(100);
return Integer.parseInt(status.readToString().trim());
} catch (NumberFormatException nfe) {
throw new IOException("corrupted content in " + status + ": " + nfe, nfe);
}
}
} else {
return null;
Expand Down