Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-40496

Need way to clear/reset allocated xvnc ports - groovy?

    XMLWordPrintable

    Details

    • Type: Task
    • Status: In Progress (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: xvnc-plugin
    • Labels:
      None
    • Similar Issues:

      Description

      See here:

      http://stackoverflow.com/questions/31481107/jenkins-xvnc-plugin-some-display-numbers-stay-allocated-when-a-build-is-stopped

      I'm having the same issue. I can probably get this done during a scheduled outage on the jenkins master, but that's really invasive. Is there any way to call a function via groovy to reset and clear the content?

        Attachments

          Activity

          Hide
          sdiepend Stijn D added a comment -

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

          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)
            }
          }
          Show
          sdiepend Stijn D added a comment - This is a groovy script I created to clean up the Xvnc display numbers without stopping jenkins. But it might also clean up numbers of still running jobs. 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) } }

            People

            • Assignee:
              levsa Levon Saldamli
              Reporter:
              nneul Nathan Neulinger
            • Votes:
              3 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: