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

P4 Plugin fails to parse changelog

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • p4-plugin
    • CloudBees Jenkins Enterprise 2.121.1.2-rolling
      P4 Plugin 1.8.9
      Docker image: cloudbees/jenkins-enterprise:2.121.1.2

    Description

      Some Jenkins jobs fail because the P4 plugin is not able to parse the changelog: 

      org.xml.sax.SAXParseException; systemId: file:/var/jenkins_home/jobs/Maintenance/builds/4/changelog5.xml; lineNumber: 1; columnNumber: 1; Premature end of file. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327) at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1472) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1014) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327) at javax.xml.parsers.SAXParser.parse(SAXParser.java:328) at org.jenkinsci.plugins.p4.changes.P4ChangeParser.parse(P4ChangeParser.java:50) Caused: org.xml.sax.SAXException: Could not parse perforce changelog: org.xml.sax.SAXParseException; systemId: file:/var/jenkins_home/jobs/Maintenance/builds/4/changelog5.xml; lineNumber: 1; columnNumber: 1; Premature end of file. at org.jenkinsci.plugins.p4.changes.P4ChangeParser.parse(P4ChangeParser.java:54) at org.jenkinsci.plugins.workflow.job.WorkflowRun.onCheckout(WorkflowRun.java:847) at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1500(WorkflowRun.java:143) at org.jenkinsci.plugins.workflow.job.WorkflowRun$SCMListenerImpl.onCheckout(WorkflowRun.java:1041) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:127) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:85) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:75) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47) at hudson.security.ACL.impersonate(ACL.java:290) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE
      

      The following error appears to be because of an invalid xml character in the perforce comment.

      org.xml.sax.SAXParseException; systemId: file:/var/jenkins_home/jobs/job-name-here/builds/1897/changelog2.xml; lineNumber: 81; columnNumber: 56; An invalid XML character (Unicode: 0x5) was found in the element content of the document.
      	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
      	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
      	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
      	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
      	at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1472)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2923)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
      	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
      	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
      	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
      	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
      	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
      	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
      	at javax.xml.parsers.SAXParser.parse(SAXParser.java:328)
      	at org.jenkinsci.plugins.p4.changes.P4ChangeParser.parse(P4ChangeParser.java:50)
      Caused: org.xml.sax.SAXException: Could not parse perforce changelog: 
      org.xml.sax.SAXParseException; systemId: file:/var/jenkins_home/jobs/job-name-here/builds/1897/changelog2.xml; lineNumber: 81; columnNumber: 56; An invalid XML character (Unicode: 0x5) was found in the element content of the document.
      	at org.jenkinsci.plugins.p4.changes.P4ChangeParser.parse(P4ChangeParser.java:54)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.onCheckout(WorkflowRun.java:847)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1500(WorkflowRun.java:143)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun$SCMListenerImpl.onCheckout(WorkflowRun.java:1041)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:127)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:85)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:75)
      	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
      	at hudson.security.ACL.impersonate(ACL.java:290)
      	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:748)
      

      Perforce comment contains a unicode characher: 

      Attachments

        Issue Links

          Activity

            rpitt Robert Pitt added a comment - - edited

            Note we're still suffering from this in a number of jobs.

            Some additional context, the file in question invariably looks perfectly but with 0 changes (valid/expected):

            <?xml version='1.0' encoding='UTF-8'?>
            <changelog>
            </changelog>

            We're using it in a pipeline job which does multiple checkouts (we have multiple p4 servers).
            I'm not sure we've ever seen it in a job which does a single checkout from one server.

            rpitt Robert Pitt added a comment - - edited Note we're still suffering from this in a number of jobs. Some additional context, the file in question invariably looks perfectly but with 0 changes (valid/expected): <?xml version='1.0' encoding='UTF-8'?> <changelog> </changelog> We're using it in a pipeline job which does multiple checkouts (we have multiple p4 servers). I'm not sure we've ever seen it in a job which does a single checkout from one server.
            beef3333 Eric Lloyd added a comment -

            I was also seeing this issue when running many parallel stages all doing checkouts.  It seems like some of the stages start before the changlog.xml is fully generated.  After the build finishes if I go on the master and check the changelog is correct.  To fix this, for now, I had to move to only allow one stage to checkout at a time but that is less than Ideal.

            I am using P4 plugin version 1.8.14

            beef3333 Eric Lloyd added a comment - I was also seeing this issue when running many parallel stages all doing checkouts.  It seems like some of the stages start before the changlog.xml is fully generated.  After the build finishes if I go on the master and check the changelog is correct.  To fix this, for now, I had to move to only allow one stage to checkout at a time but that is less than Ideal. I am using P4 plugin version 1.8.14
            peanderson peter anderson added a comment - - edited

            I have added another case where the xml parser fails. This time it appears to be related to the perforce commit comment containing a unicode character:

            These kinds of errors cause the job to fail in jenkins - this is a big problem considering some builds trigger of the success of another build. They shouldn't be failing for this reason.

            peanderson peter anderson added a comment - - edited I have added another case where the xml parser fails. This time it appears to be related to the perforce commit comment containing a unicode character: These kinds of errors cause the job to fail in jenkins - this is a big problem considering some builds trigger of the success of another build. They shouldn't be failing for this reason.
            p4karl Karl Wirth added a comment -

            Have worked with Peter and reproduced the XML parse error he reported. Created new defect:

            JENKINS-54841

            We believe the original problem still exists and is related to multiple nodes running at the same time potentially causing concurrency issues reading and writing the changelog.xml.

            p4karl Karl Wirth added a comment - Have worked with Peter and reproduced the XML parse error he reported. Created new defect: JENKINS-54841 We believe the original problem still exists and is related to multiple nodes running at the same time potentially causing concurrency issues reading and writing the changelog.xml.
            p4paul Paul Allen added a comment -

            Ready for release.

            p4paul Paul Allen added a comment - Ready for release.
            p4paul Paul Allen added a comment -

            Released in 1.9.5

            A '?' character is used for any low ascii characters not supported by XML.

            p4paul Paul Allen added a comment - Released in 1.9.5 A '?' character is used for any low ascii characters not supported by XML.
            ncapule Noel C added a comment - - edited

            Hi,

            I am getting similar issue where Jenkins is not able to generate the changes (e.g. "No changes from last build").  But changelog.xml exist and looks valid.  It looks like my issue is due to special characters (e.g. "&", and "+" at least) within the <clientId> tags such as below

            <clientId>blahblah_&_blahblah</clientId>

            I see the below in my Jenkins log:

            Could not parse Perforce changelog: /var/lib/jenkins/jobs/<job name>/builds/28/changelog.xml
            Aug 01, 2019 8:54:08 AM SEVERE org.jenkinsci.plugins.p4.changes.P4ChangeParser parse

             

            ncapule Noel C added a comment - - edited Hi, I am getting similar issue where Jenkins is not able to generate the changes (e.g. "No changes from last build").  But changelog.xml exist and looks valid.  It looks like my issue is due to special characters (e.g. "&", and "+" at least) within the <clientId> tags such as below <clientId>blahblah_&_blahblah</clientId> I see the below in my Jenkins log: Could not parse Perforce changelog: /var/lib/jenkins/jobs/<job name>/builds/28/changelog.xml Aug 01, 2019 8:54:08 AM   SEVERE   org.jenkinsci.plugins.p4.changes.P4ChangeParser parse  

            People

              p4paul Paul Allen
              peanderson peter anderson
              Votes:
              3 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: