Closed timja closed 6 years ago
Likely the Fingerprint file is corrupted (or uses wrong XML notation)
Please provide...
The error does not get propagated correctly in the code, and the unchecked cast is a bad idea. It needs some polishing at least.
JENKINS-49588 may be related
Hi Oleg,
we are seeing the same issue at the moment.
Jenkins Version is 2.112
I assume that in our case this has happened after the disk being full and Jenkins getting into an inconsistent state. Jenkins was still working but wasn't accepting webhook builds anymore. After freeing up some space, It started accepting webhooks again but is now failing with the above exception.
Is there any way to get it valid again without restarting Jenkins?
According to the current stacktrace, you "just" need to find corrupted Fingerprint files and delete/move/fix them. The file is not loaded into the memory, so there should be no need in restart once the file is fixed somehow. If you delete it, a new file will be just created. You will lose track of credentials usage, but it should be flawless in other terms
Hi Oleg,
Thanks for the reply. Here is what I've done to find existing files that are corrupted:
grep -rL "" $JENKINS_HOME/fingerprints
I found two files, one of them empty, the other one indeed corrupted (not written to the end), so I deleted both. This didn't solve the issue.
I restarted Jenkins, still no luck.
Then I was digging down into where exactly the issue was occurring. I found that multiple withCredential blocks with different credentials were failing with above exception. As I didn't know where else the fingerprint could be stored I simply updated that credentials and now builds are working again.
I am still not sure what causes it in your case, but I have created https://github.com/jenkinsci/jenkins/pull/3439 which improves diagnostics and propagates proper errors to the Fingerprint loading engine. At least users will see which file causes issues
Code changed in jenkins
User: Oleg Nenashev
Path:
test/src/test/java/hudson/model/FingerprintTest.java
http://jenkins-ci.org/commit/jenkins/cc9425039aa2f8f46153e404c226cf98b0e65659
Log:
JENKINS-51179 - Reproduce the issue in Test
Code changed in jenkins
User: Oleg Nenashev
Path:
core/src/main/java/hudson/model/Fingerprint.java
http://jenkins-ci.org/commit/jenkins/922617509eccbcb89ad3bb8b5f6e33bd5a8182c0
Log:
JENKINS-51179 - Check type of the loaded object when loading fingerprints
Code changed in jenkins
User: Oleg Nenashev
Path:
core/src/main/java/hudson/model/Fingerprint.java
test/src/test/java/hudson/model/FingerprintTest.java
http://jenkins-ci.org/commit/jenkins/9e64bcdcb4a2cf12d59dfa334e09ffb448d361e9
Log:
Merge pull request #3439 from oleg-nenashev/bug/JENKINS-51179
JENKINS-51179 - Provide diagnostics when loading corrupted fingerprint files
Compare: https://github.com/jenkinsci/jenkins/compare/cdda62c35a86...9e64bcdcb4a2
*NOTE:* This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/
Functionality will be removed from GitHub.com on January 31st, 2019.
Fixed in 2.123
Thank you!
[Originally duplicated by: JENKINS-23566]
All builds that I checked fail with following stack :
Originally reported by jozue_noon, imported from: Pipeline dies with `java.lang.String cannot be cast to hudson.model.Fingerprint`