Issue
After a failed build the XVNC plugin does not free up the allocated Display numbers and now I am out of allocated numbers
Resolution
The issue is that if a build fails, the XVNC does not clean up allocated display port numbers and the agent still thinks that port is being used. The issue is documented in JENKINS-40496 and will have a workaround in JENKINS-40430. The best solution we have right now is to use one of these scripts to free up allocated display port numbers:
-
Port range:
agentName = "XXX" displayNumbers=(25..28) DESCRIPTOR = Jenkins.getActiveInstance().getDescriptorByType(hudson.plugins.xvnc.Xvnc$DescriptorImpl.class) allocator = DESCRIPTOR.allocators.get(agentName); displayNumbers.forEach{displayNumber-> println "Before: ${allocator.allocatedNumbers}" allocator.free(displayNumber) println "After: ${allocator.allocatedNumbers}" }
-
Comma separated list:
agentName = "XXX" displayNumbers=[25,26,27,28] DESCRIPTOR = Jenkins.getActiveInstance().getDescriptorByType(hudson.plugins.xvnc.Xvnc$DescriptorImpl.class) allocator = DESCRIPTOR.allocators.get(agentName); displayNumbers.forEach{displayNumber-> println "Before: ${allocator.allocatedNumbers}" allocator.free(displayNumber) println "After: ${allocator.allocatedNumbers}" }
Put either one of those into your script console to have it free up the display numbers inside of the Brackets []
.