This is a groovy script I created to clean up the Xvnc display numbers 
without stopping jenkins. But it will also clean up numbers of still 
running jobs.


https://github.com/sdiepend/jenkins-monitoring/blob/master/cleanXvncDisplayNumbers.groovy


<https://github.com/sdiepend/jenkins-monitoring/blob/master/cleanXvncDisplayNumbers.groovy>

import jenkins.* 
import jenkins.model.Jenkins 

Jenkins jenkins = Jenkins.getActiveInstance(); 
xvncDescriptor = 
jenkins.getDescriptorByType(hudson.plugins.xvnc.Xvnc.DescriptorImpl.class) 

xvncDescriptor.allocators.each { 

  allocator = it.value 
  // collect is used to make sure numAlloc is an entire new list and not just a 
reference to the same list object, otherwise you'll get a 
  // concurrentmodification exception 
  numAlloc = allocator.allocatedNumbers.collect() 
  numAlloc.each { 
    allocator.allocatedNumbers.remove(it) 
  } 
}

 

Op maandag 22 februari 2016 17:50:25 UTC+1 schreef Umesh Padhye:
>
> Hello All,
>
> I am getting following error on one of my Linux node which is RHEL 6.7.
> Somehow Jenkins can not remove the old displays numbers which are not in 
> use now.
>
> Manually I can launch the vncserver command fine.
> Please suggest me what to do.
>
>
> FATAL: All available display numbers are allocated or blacklisted.
> allocated: [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 
> 25, 26, 27, 28, 29, 30, 158, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 
> 42, 43, 44, 45, 46, 47, 175, 48, 49, 50, 51, 52, 53, 54, 55, 183, 56, 57, 
> 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 
> 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 
> 96, 97, 98, 99, 116]
> blacklisted: []
> java.lang.RuntimeException: All available display numbers are allocated or 
> blacklisted.
> allocated: [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 
> 25, 26, 27, 28, 29, 30, 158, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 
> 42, 43, 44, 45, 46, 47, 175, 48, 49, 50, 51, 52, 53, 54, 55, 183, 56, 57, 
> 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 
> 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 
> 96, 97, 98, 99, 116]
> blacklisted: []
> at 
> hudson.plugins.xvnc.DisplayAllocator.doAllocate(DisplayAllocator.java:59)
> at hudson.plugins.xvnc.DisplayAllocator.allocate(DisplayAllocator.java:49)
> at hudson.plugins.xvnc.Xvnc.doSetUp(Xvnc.java:104)
> at hudson.plugins.xvnc.Xvnc.setUp(Xvnc.java:94)
> at jenkins.tasks.SimpleBuildWrapper.setUp(SimpleBuildWrapper.java:145)
> at hudson.model.Build$BuildExecution.doRun(Build.java:156)
> at 
> hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
> at hudson.model.Run.execute(Run.java:1738)
> at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
> at hudson.model.ResourceController.execute(ResourceController.java:98)
> at hudson.model.Executor.run(Executor.java:410)
>
>
> -- 
> Thanks & Regards,
>  
> Umesh C. Padhye
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/6b96dd1f-95cb-4f7d-ac6e-0be5f865667d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to