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

Xvfb in a parallel pipeline doesn't use the executor number as display name

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • xvfb-plugin
    • None
    • Jenkins 2.28
      Xvfb plugin 1.1.3

      Using the following example pipeline

      stage('stage_1') {
        parallel (
          's_1_1': {
            node() {
              wrap([$class: 'Xvfb']) {
                  sh 'sleep 10'
              }
            }
          },
          's_1_2': {
            node() {
              wrap([$class: 'Xvfb']) {
                  sh 'sleep 10'
              }
            }
          }
        )
      }
      

      the Xvfb binary is always invoked with ":0" as screen name, even if the documentation suggests the screen name should match the executor number + offset.
      Manually specifying displayNameOffset has no effect.

      The only way to make it work in parallel is by setting autoDisplayName, but we've experienced random failures with that option too. It would be great for the default behavior to allow parallel jobs without any manual configuration.

          [JENKINS-39415] Xvfb in a parallel pipeline doesn't use the executor number as display name

          Creating a freestyle job, enabling Xvfb with default options and triggering two concurrent runs of the job has the expected behavior - the screen name matches the executor number.

          Giuseppe Iannello added a comment - Creating a freestyle job, enabling Xvfb with default options and triggering two concurrent runs of the job has the expected behavior - the screen name matches the executor number.

          The plugin has an option to determine the display name automatically, as of 1.0.9:

          New feature in version 1.0.9 - auto display name (on newer Xvfb versions)
          Use Let Xvfb choose display name option with Xvfb that supports displayfd option to choose the display number automatically by Xvfb.

          How can we enable this in a pipeline script?

          Gareth Western added a comment - The plugin has an option to determine the display name automatically, as of 1.0.9: New feature in version 1.0.9 - auto display name (on newer Xvfb versions) Use Let Xvfb choose display name option with Xvfb that supports displayfd option to choose the display number automatically by Xvfb. How can we enable this in a pipeline script?

          zregvart added a comment -

          gareth_western in wrap step you can place any parameters supported by the plugin, like:

          wrap([$class: 'Xvfb', autoDisplayName: true]) {
          //...
          }
          

          For auto display name make sure that your Xvfb installation supports -displayfd command line option.

          zregvart added a comment - gareth_western in wrap step you can place any parameters supported by the plugin, like: wrap([$class: 'Xvfb' , autoDisplayName: true ]) { //... } For auto display name make sure that your Xvfb installation supports -displayfd command line option.

          Thanks zregvart! I missed the part where Giuseppe says he already tried that option but experienced "random failures". I guess it would be interesting to know more about those failures. If we experience the same then I will create a separate issue.

          Gareth Western added a comment - Thanks zregvart ! I missed the part where Giuseppe says he already tried that option but experienced "random failures". I guess it would be interesting to know more about those failures. If we experience the same then I will create a separate issue.

          We managed to track down those random failures to the plugin timing out waiting for Xvfb to return a display number. Increasing the timeout with 'autoDisplayName': true, 'timeout': 15 solves the problem, but slows down the builds - as far as I understood, that's not really a timeout, but more like a wait time before checking the output of Xvfb for the display number.

          Giuseppe Iannello added a comment - We managed to track down those random failures to the plugin timing out waiting for Xvfb to return a display number. Increasing the timeout with 'autoDisplayName': true, 'timeout': 15 solves the problem, but slows down the builds - as far as I understood, that's not really a timeout , but more like a wait time before checking the output of Xvfb for the display number.

            zregvart zregvart
            giannello Giuseppe Iannello
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: