If an exception is thrown by persistNode in Nodes#addNode, then the node will still exist in memory, but it may not exist on disk (or the disk form may be corrupted). This could happen for various reasons, but in particular JEP-200 issues when serializing the node will throw an exception from persistNode and cause this problem.
The issue was originally noticed by jglick while investigating JENKINS-50480. The result of the error in that case was that a test logged a severe error because of a failure to add the node in Nodes#addNode, but the test actually passed because the node could be accessed in memory. It would have been better for that test to fail so that the JEP-200 error did not go unnoticed.
I think it makes sense to remove the node from memory if the call to persistNode throws an exception, so that the Nodes#addNode call does not fail in a half-finished state.
- relates to
-
JENKINS-50480 UnsupportedOperationException: Refusing to marshal com.github.dockerjava.api.*
- Resolved
- links to