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

Provided config file is sometimes not complete

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Labels:
      None
    • Environment:
      Jenkins LTS 2.83.1
      Config File Provider Plugin 2.16.4
    • Similar Issues:

      Description

      Sometimes when I tried to parse JSON config file I encountered following exception:

      net.sf.json.JSONException: Found starting '{' but missing '}' at the end. at character 0 of null

      It turns out that returned file was not complete. I reproduced the issue this way:

      node {
        for (int i = 0; i < 40; i++) {
          configFileProvider([configFile(fileId: 'file-id', variable: 'configfile')]) {
            readJSON(text: readFile(file: configfile))
          }
        }
      }

      Printing file content to console proves that it is readed to early. Adding file existance check helps:

      node {
        for (int i = 0; i < 40; i++) {
          configFileProvider([configFile(fileId: 'file-id', variable: 'configfile')]) {
            if (fileExists(file: configfile)) {
              readJSON(text: readFile(file: configfile))
            } else {
              error("File '$configfile' not found")
            }
          }
        }
      }
      

        Attachments

          Issue Links

            Activity

            Hide
            imod Dominik Bartholdi added a comment -

            I would very much like to fix this, but as stated previously, I'm not able to reproduce the issue in my env. I have an idea for a fix, but would need someone to try it before I ship it. Anyone willing to help/test out?

            Show
            imod Dominik Bartholdi added a comment - I would very much like to fix this, but as stated previously, I'm not able to reproduce the issue in my env. I have an idea for a fix, but would need someone to try it before I ship it. Anyone willing to help/test out?
            Hide
            aviadm Aviad M added a comment - - edited

            Dominik Bartholdi

            It's a master and 5-6 slaves.

            Linux (Ubuntu 16.04 servers) and windows (2012 servers) slaves, however the problem occurs on the linux slaves (haven't tried personally the windows ones).

            I save a plain config file in a .env format.

             

            It takes some build attempts in order to the file successfully being present in the slave machine.

            I have, like the author of this thread, an IF clause alerting me if the file not present when the build starts.

            More details here.

             

            Show
            aviadm Aviad M added a comment - - edited Dominik Bartholdi It's a master and 5-6 slaves. Linux (Ubuntu 16.04 servers) and windows (2012 servers) slaves, however the problem occurs on the linux slaves (haven't tried personally the windows ones). I save a plain config file in a .env  format.   It takes some build attempts in order to the file successfully being present in the slave machine. I have, like the author of this thread, an IF clause alerting me if the file not present when the build starts. More details  here .  
            Hide
            imod Dominik Bartholdi added a comment -

            Aviad M can you provide some more background? so far I was not able to reproduce this issue, even with 10'000 executions of a job.

             

            e.g.

            • how does your environment look like?
            • master only? or slaves?
            • what OS?
            • size of files?
            • config file type?
            • ...

             

            Show
            imod Dominik Bartholdi added a comment - Aviad M can you provide some more background? so far I was not able to reproduce this issue, even with 10'000 executions of a job.   e.g. how does your environment look like? master only? or slaves? what OS? size of files? config file type? ...  
            Hide
            aviadm Aviad M added a comment - - edited

            For some reason my thread has been closed. We suffer from this a lot.

             

            Plugin version: 2.18

            Jenkins version: 2.89

            Show
            aviadm Aviad M added a comment - - edited For some reason my thread has been closed. We suffer from this a lot.   Plugin version: 2.18 Jenkins version: 2.89
            Hide
            imod Dominik Bartholdi added a comment -

            I tried to reproduce this issue, but even with the provided pipeline and more then 100 executions, I was not able to do so

             

            Most likely, the problem is somewhere in org.jenkinsci.lib.configprovider.model.ConfigFileManager#provisionConfigFile , but so far I did not find the culprit...

            Show
            imod Dominik Bartholdi added a comment - I tried to reproduce this issue, but even with the provided pipeline and more then 100 executions, I was not able to do so   Most likely, the problem is somewhere in org.jenkinsci.lib.configprovider.model.ConfigFileManager#provisionConfigFile , but so far I did not find the culprit...
            Hide
            asavanchuk Alaiksei Savanchuk added a comment -

            Hi.

            We use this plugin a lot in our environment and we face this issue really often.

            Jenkins version : Jenkins ver. 2.89.1

            Config file provider plugin : 2.16.4

            Thanks.

            Show
            asavanchuk Alaiksei Savanchuk added a comment - Hi. We use this plugin a lot in our environment and we face this issue really often. Jenkins version :  Jenkins ver. 2.89.1 Config file provider plugin :  2.16.4 Thanks.

              People

              • Assignee:
                domi Dominik Bartholdi
                Reporter:
                abeben Adam Beben
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: