[JENKINS-25519] If unable to read exitStatus file then wait briefly and retry one more time to allow write to complete#65
Conversation
…e time to allow write to complete
jglick
left a comment
There was a problem hiding this comment.
I think it is safe enough, if the problem was in fact diagnosed correctly. I swear there was some earlier attempt to fix this, but I cannot find it. JENKINS-25519 describes a similar-sounding case but note that the exception is repeatedly thrown—meaning that the file was created but stayed empty, for some reason. So this should perhaps be considered only a hotfix:
- root cause not obvious (is it really just a simple race condition?)
- caller should perhaps treat this as fatal
| @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) { |
There was a problem hiding this comment.
Well this alone would fix the issue, right?
There was a problem hiding this comment.
Theoretically, yes, if there's no bogus whitespace or other stuff in there.
|
Ah, maybe I was thinking of #37—similar problem (at least on the face of it), different file. If the problem is indeed a simple race condition, tricks like this are not the best fix. Rather, the wrapper script should be changed from …; echo $? > …/exitto which ought to be atomic. |
|
@jglick Has requested a test-comment, please ignore this. @cloudbees/team-arc |
|
Closing in favor of #66 |
Proposed solution to error like this, encountered when statusCode file exists but is empty, potentially when created but not written to yet, or not written fully:
Variant of JENKINS-25519
This may not be the best solution to the problem in my opinion but should generally solve it.
Other options: