[JIRA] (JENKINS-57918) SCM Checkout: java.lang.ArrayIndexOutOfBoundsException: -1

1 view
Skip to first unread message

sascha.kolberg.dg@gmail.com (JIRA)

unread,
Jun 8, 2019, 11:20:03 AM6/8/19
to jenkinsc...@googlegroups.com
Sascha Kolberg created an issue
 
Jenkins / Bug JENKINS-57918
SCM Checkout: java.lang.ArrayIndexOutOfBoundsException: -1
Issue Type: Bug Bug
Assignee: Unassigned
Components: pipeline, repo-plugin, scm-api-plugin
Created: 2019-06-08 15:19
Environment: Jenkins 2.164.2
Pipeline: SCM Step 2.9
REPO plugin 1.10.7
Priority: Minor Minor
Reporter: Sascha Kolberg

After an update of a couple of plugins yesterday,

SCM checkout fails for Gerrit Repo.

if changelog is set to true:

java.lang.ArrayIndexOutOfBoundsException: -1
	at com.thoughtworks.xstream.core.util.FastStack.pop(FastStack.java:42)
	at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:125)
	at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:103)
	at com.thoughtworks.xstream.io.xml.XppReader.<init>(XppReader.java:63)
	at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:54)
	at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1044)
	at hudson.plugins.repo.ChangeLog.parse(ChangeLog.java:79)
	at hudson.plugins.repo.ChangeLog.parse(ChangeLog.java:59)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun.onCheckout(WorkflowRun.java:835)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1100(WorkflowRun.java:133)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun$SCMListenerImpl.onCheckout(WorkflowRun.java:1100)
	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:140)
	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
	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:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

if changelog is set to false:

Similar exception without a stacktrace:

...

00:03:19.618  Added a project: packages/apps/CMFileManager at revision: e65455f23ed00b7cddebb7bd21991363a944ba75
00:03:19.618  Added a project: external/can-utils at revision: 47f2e7a180e50ee998f2e6aea45884f84042c4fa
00:03:19.618  Added a project: external/i2c-tools at revision: b1bef14300a951d0a5ba02a43a05977bb5624fda
00:03:19.618  Manifest at revision: 48405e81e6b420fede221c0922afd26b444cd61e
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // timestamps
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
[BFA] Scanning build for known causes...
[BFA] No failure causes found
[BFA] Done. 0s
java.lang.ArrayIndexOutOfBoundsException
Finished: FAILURE

Git checkout works as expected.

I first reverted the the Pipeline: Step API to 2.8.
Did not help, though. Next, I will downgrade everything I updated yesterday.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

sascha.kolberg.dg@gmail.com (JIRA)

unread,
Jun 12, 2019, 3:05:02 AM6/12/19
to jenkinsc...@googlegroups.com
Sascha Kolberg commented on Bug JENKINS-57918
 
Re: SCM Checkout: java.lang.ArrayIndexOutOfBoundsException: -1

After a rollback of all recently updated plugins, setting

changelog: false,

makes checkout work again and the build can run.

... puzzling

laurent.soest@bernina.com (JIRA)

unread,
Jun 12, 2019, 4:42:03 AM6/12/19
to jenkinsc...@googlegroups.com

Hi I have the same issue.

"SCM checkout fails for Gerrit Repo."

As a workaround I downgraded Pipeline SCM Step Plugin to 2.7 and it is working again.

sascha.kolberg.dg@gmail.com (JIRA)

unread,
Jun 13, 2019, 1:30:02 AM6/13/19
to jenkinsc...@googlegroups.com
Sascha Kolberg updated an issue
Change By: Sascha Kolberg
After an update of a couple of plugins yesterday,

SCM checkout fails for _Gerrit Repo_.

if _changelog_ is set to _true_:

{code:java|collapse=true}

java.lang.ArrayIndexOutOfBoundsException: -1
at com.thoughtworks.xstream.core.util.FastStack.pop(FastStack.java:42)
at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:125)
at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:103)
at com.thoughtworks.xstream.io.xml.XppReader.<init>(XppReader.java:63)
at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:54)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1044)
at hudson.plugins.repo.ChangeLog.parse(ChangeLog.java:79)
at hudson.plugins.repo.ChangeLog.parse(ChangeLog.java:59)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.onCheckout(WorkflowRun.java:835)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1100(WorkflowRun.java:133)
at org.jenkinsci.plugins.workflow.job.WorkflowRun$SCMListenerImpl.onCheckout(WorkflowRun.java:1100)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:140)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
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:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
{code}

if _changelog_ is set to _false_:


Similar exception without a stacktrace:

{code:java|collapse=true}

...

00:03:19.618  Added a project: packages/apps/CMFileManager at revision: e65455f23ed00b7cddebb7bd21991363a944ba75
00:03:19.618  Added a project: external/can-utils at revision: 47f2e7a180e50ee998f2e6aea45884f84042c4fa
00:03:19.618  Added a project: external/i2c-tools at revision: b1bef14300a951d0a5ba02a43a05977bb5624fda
00:03:19.618  Manifest at revision: 48405e81e6b420fede221c0922afd26b444cd61e
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // timestamps
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
[BFA] Scanning build for known causes...
[BFA] No failure causes found
[BFA] Done. 0s
java.lang.ArrayIndexOutOfBoundsException
Finished: FAILURE
{code}


Git checkout works as expected.

I first reverted the the Pipeline: SCM Step API to 2.8.

Did not help, though. Next, I will downgrade everything I updated yesterday.

sascha.kolberg.dg@gmail.com (JIRA)

unread,
Jun 13, 2019, 1:31:02 AM6/13/19
to jenkinsc...@googlegroups.com

Thanks for the hint.
I did not see the update to 2.8 on 5th of June which fixes JENKINS-34313.

sascha.kolberg.dg@gmail.com (JIRA)

unread,
Jun 13, 2019, 1:32:02 AM6/13/19
to jenkinsc...@googlegroups.com

-
Pipeline: SCM Step API to -> 2.8
- Pipeline: SCM Step -> 2
.
8
Did not help, though. Next, I will downgrade everything I updated yesterday.

sascha.kolberg.dg@gmail.com (JIRA)

unread,
Jun 13, 2019, 1:33:02 AM6/13/19
to jenkinsc...@googlegroups.com
- Pipeline: Step API -> 2. 8 19
- Pipeline: SCM Step -> 2.8
Did not help, though. Next, I will downgrade everything I updated yesterday.

fabian.oboril@gmx.net (JIRA)

unread,
Jun 18, 2019, 7:36:02 AM6/18/19
to jenkinsc...@googlegroups.com

Same issue here. It was caused by upgrading Jenkins to version 2.176 from 2.164. In our case it helped to disable the changelog (checkout changelog: false, poll: false, scm: [...] ) A fix for the changelog would be welcome.

kiyoaki.hoshino@gmail.com (JIRA)

unread,
Aug 13, 2019, 9:32:03 AM8/13/19
to jenkinsc...@googlegroups.com

kiyoaki.hoshino@gmail.com (JIRA)

unread,
Aug 13, 2019, 9:33:02 AM8/13/19
to jenkinsc...@googlegroups.com
Kiyoaki Hoshino updated an issue
Change By: Kiyoaki Hoshino
Component/s: workflow-scm-step-plugin

kiyoaki.hoshino@gmail.com (JIRA)

unread,
Aug 13, 2019, 9:44:03 AM8/13/19
to jenkinsc...@googlegroups.com

Hi All. I have the same issue.

{{checkout([$class: 'RepoSCM' ... ) }}fails and build procedure does not start.

Pipeline: SCM Step (workflow-scm-step) Plugin 2.7 + REPO Plugin 1.10.7 works OK but

Pipeline: SCM Step (workflow-scm-step) Plugin 2.9 + REPO Plugin 1.10.7 does not work.

kiyoaki.hoshino@gmail.com (JIRA)

unread,
Aug 13, 2019, 9:45:02 AM8/13/19
to jenkinsc...@googlegroups.com
Kiyoaki Hoshino edited a comment on Bug JENKINS-57918
Hi All. I have the same issue.

{{ checkout([$class: 'RepoSCM' ... ) }}
fails and build procedure does not start.

Pipeline: SCM Step (workflow-scm-step) Plugin *2.7* + REPO Plugin 1.10.7 works *OK* but

Pipeline: SCM Step (workflow-scm-step) Plugin *2.9* + REPO Plugin 1.10.7 does *not work*.

kiyoaki.hoshino@gmail.com (JIRA)

unread,
Aug 13, 2019, 9:53:07 AM8/13/19
to jenkinsc...@googlegroups.com

dnusbaum@cloudbees.com (JIRA)

unread,
Aug 13, 2019, 11:34:03 AM8/13/19
to jenkinsc...@googlegroups.com
Devin Nusbaum updated an issue
Change By: Devin Nusbaum
Component/s: pipeline
Component/s: scm-api-plugin

dnusbaum@cloudbees.com (JIRA)

unread,
Aug 13, 2019, 12:02:02 PM8/13/19
to jenkinsc...@googlegroups.com

Here is the diff from workflow-scm-step 2.7 to 2.9. The main changes are that 2.8+ uses Files.createTempFile to create changelog files so that concurrent checkouts don't end up using the same file, which means that the changelog file always exists but is empty when SCM.checkout is called, and that in 2.8+ any exceptions thrown during checkout will result in the changelog file being deleted.

It's not totally obvious to me what the root problem might be here. Perhaps it has something to do with the changelog file existing but being empty causing REPO to not write it correctly, and then REPO fails when it tries to parse the empty file? Do you see any messages in your Jenkins system logs when a build fails with this error, in particular any messages from AtomicFileWriter?

dnusbaum@cloudbees.com (JIRA)

unread,
Aug 13, 2019, 12:06:04 PM8/13/19
to jenkinsc...@googlegroups.com
Devin Nusbaum edited a comment on Bug JENKINS-57918
[Here|https://github.com/jenkinsci/workflow-scm-step-plugin/compare/workflow-scm-step-2.7..workflow-scm-step-2.9] is the diff from workflow-scm-step 2.7 to 2.9. The main changes are that 2.8+ uses {{Files.createTempFile}} to create changelog files so that concurrent checkouts don't end up using the same file, which means that the changelog file always exists but is empty when {{SCM.checkout}} is called, and that in 2.8+ any exceptions thrown during checkout will result in the changelog file being deleted.

It's not totally obvious to me what the root problem might be here. Perhaps it has something to do with the changelog file existing but being empty causing REPO to not write it correctly, and then REPO fails when it tries to parse the empty file? Do you see any messages in your Jenkins system logs when a build fails with this error, in particular any messages from {{AtomicFileWriter}}?
Also, what OS are you using?

kiyoaki.hoshino@gmail.com (JIRA)

unread,
Aug 13, 2019, 11:13:03 PM8/13/19
to jenkinsc...@googlegroups.com

Dear Devin,

Thank you for your comment.

I am using Jenkins docker container on Ubuntu 18.04.

Jenkins docker image is using Alpine Linux.

https://jenkins.io/doc/book/installing/

Also there is the same problem on Jenkins apk installed to Ubuntu Linux.

kiyoaki.hoshino@gmail.com (JIRA)

unread,
Aug 13, 2019, 11:44:02 PM8/13/19
to jenkinsc...@googlegroups.com
Kiyoaki Hoshino edited a comment on Bug JENKINS-57918

kiyoaki.hoshino@gmail.com (JIRA)

unread,
Aug 14, 2019, 3:15:02 AM8/14/19
to jenkinsc...@googlegroups.com
Kiyoaki Hoshino edited a comment on Bug JENKINS-57918
Dear Devin,

Thank you for your comment.

I am using Jenkins docker container on Ubuntu 18.04.

[https://jenkins.io/doc/book/installing/]

Also there is the same problem on Jenkins
apk apt installed to Ubuntu Linux.

kiyoaki.hoshino@gmail.com (JIRA)

unread,
Aug 14, 2019, 10:31:02 PM8/14/19
to jenkinsc...@googlegroups.com

Dear Devin,

I checked http://<jenkins.server>/log/all .
But I cannot find any messages like AtomicFileWriter.
(If I need to change Logging Level, please tell me how to configure Log Recoder settings.)

Log message when Pipeline: SCM Step (workflow-scm-step) Plugin 2.9 + REPO Plugin 1.10.7 does not work.
Aug 15, 2019 1:36:36 AM INFO hudson.plugins.repo.RepoScm checkoutCode
Checking out code in: Android
Aug 15, 2019 1:36:44 AM INFO hudson.plugins.repo.ChangeLog saveChangeLog
No logs found
Aug 15, 2019 1:36:46 AM INFO org.jenkinsci.plugins.workflow.job.WorkflowRun finish
pipeline_checkout_test #22 completed: FAILURE

Log message when Pipeline: SCM Step (workflow-scm-step) Plugin 2.7 + REPO Plugin 1.10.7 works OK
Aug 15, 2019 1:37:34 AM INFO hudson.plugins.repo.RepoScm checkoutCode
Checking out code in: Android
Aug 15, 2019 1:37:34 AM INFO hudson.plugins.repo.ChangeLog saveChangeLog
No logs found
Aug 15, 2019 1:37:37 AM INFO org.jenkinsci.plugins.workflow.job.WorkflowRun finish
pipeline_checkout_test #23 completed: SUCCESS

isarkisov@gmail.com (JIRA)

unread,
Aug 19, 2019, 11:50:01 PM8/19/19
to jenkinsc...@googlegroups.com

We are experienced same problem after upgrading all Pipeline plugins, had to revert everything.

dnusbaum@cloudbees.com (JIRA)

unread,
Aug 20, 2019, 10:28:02 AM8/20/19
to jenkinsc...@googlegroups.com

Ok, from Kiyoaki Hoshino's logs I think I figured out the problem. Repo plugin doesn't create a changelog file if there are no changes (I guess other SCM plugins create an empty changelog file in that case, which is why this problem only shows up for Repo plugin). Because the changelog file is now actually created in workflow-scm-step if changelogs are enabled, rather than just passing a reference to a file that doesn't exist, we pass the check here that only calls the changelog parser if the file exists.

This could be fixed by having workflow-scm-step check if the file's size is 0 before passing it to SCMListener.onCheckout here, or by having Repo plugin create an empty changelog file here instead of leaving the file empty.

isarkisov@gmail.com (JIRA)

unread,
Aug 21, 2019, 2:13:03 PM8/21/19
to jenkinsc...@googlegroups.com
Igor Sarkisov edited a comment on Bug JENKINS-57918
We are experienced same problem after upgrading all Pipeline plugins, had to revert everything.

kiyoaki.hoshino@gmail.com (JIRA)

unread,
Aug 21, 2019, 4:51:13 PM8/21/19
to jenkinsc...@googlegroups.com

Dear Devin,

Thank you for your analysis and solution.

I hope the next Pipeline SCM Step plugin release.

liejuntao001@gmail.com (JIRA)

unread,
Oct 21, 2019, 12:10:02 AM10/21/19
to jenkinsc...@googlegroups.com

Is there any plan to fix this problem soon?

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

willi1s@hotmail.com (JIRA)

unread,
Oct 24, 2019, 3:43:04 PM10/24/19
to jenkinsc...@googlegroups.com

I have added a pull request to the jenkinsci/repo-plugin repository to work around this issue:

https://github.com/jenkinsci/repo-plugin/pull/56

laurent.soest@bernina.com (JIRA)

unread,
Dec 5, 2019, 5:35:03 AM12/5/19
to jenkinsc...@googlegroups.com

pete.neal@sepura.com (JIRA)

unread,
Dec 5, 2019, 6:48:02 AM12/5/19
to jenkinsc...@googlegroups.com

I have repo plugin 1.11.1 on Jenkins 2.201 and can confirm it has fixed the issue for me.  (previously I was using a private build of Simon Williams fix)

dnusbaum@cloudbees.com (JIRA)

unread,
Jan 14, 2020, 1:22:08 PM1/14/20
to jenkinsc...@googlegroups.com
Devin Nusbaum resolved as Fixed
 

Closing as resolved in Repo Plugin version 1.11.0+ according to comments here. Looks like the PR that fixed it was https://github.com/jenkinsci/repo-plugin/pull/54JENKINS-59560 looks possibly related so I opened https://github.com/jenkinsci/workflow-scm-step-plugin/pull/37 to try to prevent this kind of issue from affecting other SCMs going forward.

Change By: Devin Nusbaum
Status: Open Resolved
Resolution: Fixed
Released As: repo 1.11.0

dnusbaum@cloudbees.com (JIRA)

unread,
Jan 22, 2020, 5:15:05 PM1/22/20
to jenkinsc...@googlegroups.com

This was also fixed on Pipeline: SCM Step Plugin's side in version 2.10.

dnusbaum@cloudbees.com (JIRA)

unread,
Jan 22, 2020, 5:16:02 PM1/22/20
to jenkinsc...@googlegroups.com
Devin Nusbaum updated an issue
Change By: Devin Nusbaum
Released As: repo 1.11.0 , workflow-scm-step 2.10
Reply all
Reply to author
Forward
0 new messages