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

"P4JAVA: Error in finding type of stream.java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0" since release 1.17.0

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • p4-plugin
    • None
    • Jenkins version: 2.479.2
      P4 Plugin version: 1.17.0
      Java Runtime version: 17.0.13+11-Ubuntu-2ubuntu122.04
      P4JAVA version: 2024.2/2695691

      Projects with "Pipeline script from SCM" fail with the following error in the pipeline log:

      [2024-12-30T07:32:52.472Z] P4 Task: establishing connection.
      [2024-12-30T07:32:52.472Z] ... server: ssl:perforce.domain.com:1666
      [2024-12-30T07:32:52.472Z] ... node: gui-jenkins
      [2024-12-30T07:32:52.484Z] (p4):cmd:... p4 where /var/lib/jenkins/workspace/Check Make Status%40script/607502807ca3___
      [2024-12-30T07:32:52.484Z] p4 where /var/lib/jenkins/workspace/Check Make Status%40script/607502807ca37d1ed7242a4077864b02087909c2baae05ef5fc241c699aebe2d/Check_Make_Status.jenkinsfile
      [2024-12-30T07:32:52.484Z]
      [2024-12-30T07:32:52.493Z] (p4):stop:11
      [2024-12-30T07:32:52.505Z] (p4):cmd:... p4 streams
      [2024-12-30T07:32:52.505Z] p4 streams
      [2024-12-30T07:32:52.505Z]
      [2024-12-30T07:32:52.513Z] (p4):stop:12
      [2024-12-30T07:32:52.515Z] P4 Task: attempt: 1
      [2024-12-30T07:32:55.516Z] ERROR: P4: Task Exception: java.lang.RuntimeException: P4JAVA: Error in finding type of stream.java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
      [2024-12-30T07:32:55.516Z] Retrying after 10 seconds

          [JENKINS-75076] "P4JAVA: Error in finding type of stream.java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0" since release 1.17.0

          Andreas added a comment -

          Hi, Stream is empty in my project's configuration. Does that help already?

          Andreas added a comment - Hi, Stream is empty in my project's configuration. Does that help already?

          Dhaval added a comment -

          If stream is selected as workspace behavior, it cannot be empty.

          Dhaval added a comment - If stream is selected as workspace behavior, it cannot be empty.

          Andreas added a comment -

          Workspace behavior is "Manual (custom view)", Stream and Stream at change both are empty.

          Andreas added a comment - Workspace behavior is "Manual (custom view)", Stream and Stream at change both are empty.

          Dhaval added a comment -

          In manual (custom view) either stream or view mappings should be given.
          I am pretty certain this is some configuration issue.

          Can you share your jenkins pipeline logs, from jobs folder please share config.xml and build.xml so that we can understand your problem better?

          Dhaval added a comment - In manual (custom view) either stream or view mappings should be given. I am pretty certain this is some configuration issue. Can you share your jenkins pipeline logs, from jobs folder please share config.xml and build.xml so that we can understand your problem better?

          Jarosław added a comment - - edited

          Hi, I'm seeing the same issue with 1.17.0 version. In my case it's a scripted pipeline and also a custom view. The checkout step looks something like this:

          String mapping(String workspace, String branch, String arch, String type) {
            final String depotPath = "//depot/${type}";
            final String workSpacePath = "//${workspace}/depot/${type}";
          
            String mapping = """
              ${depotPath}/${branch}/... ${workSpacePath}/${branch}/...
              //depot/prod/MAIN/unittests/services/testrunner/... //${workspace}/depot/prod/MAIN/unittests/services/testrunner/...
              //depot/prod/MAIN/unittests/services/automation/... //${workspace}/depot/prod/MAIN/unittests/services/automation/...
              //depot/tests/services/MAIN/automation/tools/linux/... //${workspace}/depot/tests/services/MAIN/automation/tools/linux/...
              //depot/tests/services/MAIN/automation/tools/common/... //${workspace}/depot/tests/services/MAIN/automation/tools/common/...
              //depot/tests/services/MAIN/automation/playbooks/... //${workspace}/playbooks/...
              //depot/tests/services/MAIN/media/... //${workspace}/depot/tests/services/MAIN/media/...
            """.stripIndent();
          
            return mapping;
          }
          
          ...
          
          checkout perforce(
            credential: '[creds]',
            populate: autoClean(
              delete: true, modtime: false, pin: change, quiet: true, replace: true,
              tidy: false, parallel: [
                enable: true, minbytes: '1024', minfiles: '1', threads: '4'
              ]
            ),
            workspace: manualSpec(
              name: workspace,
              charset: 'none', pinHost: false, spec: clientSpec(
                allwrite: false, backup: true, changeView: '', clobber: true,
                compress: true, line: 'LOCAL', locked: false, modtime: false,
                rmdir: true, serverID: '', streamName: '', type: 'WRITABLE',
                view: mapping(workspace, branch, mapping, type)
              )
            )
          )

          I'm happy to provide additional information if needed.

          Jarosław added a comment - - edited Hi, I'm seeing the same issue with 1.17.0 version. In my case it's a scripted pipeline and also a custom view. The checkout step looks something like this: String mapping( String workspace, String branch, String arch, String type) {   final String depotPath = " //depot/${type}" ;   final String workSpacePath = " //${workspace}/depot/${type}" ; String mapping = """     ${depotPath}/${branch}/... ${workSpacePath}/${branch}/...     //depot/prod/MAIN/unittests/services/testrunner/... //${workspace}/depot/prod/MAIN/unittests/services/testrunner/...     //depot/prod/MAIN/unittests/services/automation/... //${workspace}/depot/prod/MAIN/unittests/services/automation/...     //depot/tests/services/MAIN/automation/tools/linux/... //${workspace}/depot/tests/services/MAIN/automation/tools/linux/...     //depot/tests/services/MAIN/automation/tools/common/... //${workspace}/depot/tests/services/MAIN/automation/tools/common/...     //depot/tests/services/MAIN/automation/playbooks/... //${workspace}/playbooks/...     //depot/tests/services/MAIN/media/... //${workspace}/depot/tests/services/MAIN/media/... """.stripIndent(); return mapping; } ... checkout perforce(   credential: '[creds]' ,   populate: autoClean(     delete: true , modtime: false , pin: change, quiet: true , replace: true ,     tidy: false , parallel: [       enable: true , minbytes: '1024' , minfiles: '1' , threads: '4'     ]   ),   workspace: manualSpec(     name: workspace,     charset: 'none' , pinHost: false , spec: clientSpec(       allwrite: false , backup: true , changeView: '', clobber: true ,       compress: true , line: 'LOCAL' , locked: false , modtime: false ,       rmdir: true , serverID: '', streamName: ' ', type: ' WRITABLE',       view: mapping(workspace, branch, mapping, type)     )   ) ) I'm happy to provide additional information if needed.

          Sandeep Kumar added a comment - - edited

          jwierzbi andreas_rueger could you please provide the log that contains the stack trace for the following exception?
          ERROR: P4: Task Exception: java.lang.RuntimeException: P4JAVA: Error in finding type of stream.java.lang.IndexOutOfBoundsException: 
          stream.java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0

          Also share the following:

          output of: "p4 streams" command

          config.xml and build.xml from jobs folder.

          Sandeep Kumar added a comment - - edited jwierzbi andreas_rueger could you please provide the log that contains the stack trace for the following exception? ERROR: P4: Task Exception: java.lang.RuntimeException: P4JAVA: Error in finding type of stream.java.lang.IndexOutOfBoundsException:  stream.java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0 Also share the following: output of: "p4 streams" command config.xml and build.xml from jobs folder.

          Andreas added a comment -

          Hi,

          thank you for looking into this. I completely forgot to say that before. Enclosed please find the complete folder of a job named "Hello World" including two builds. Build 1 was successful with P4 plugin 1.16.0 and build 2 with P4 plugin version 1.17.0 ended with failure. I have anonymized the data. The output of the "p4 streams" command on the jenkins server is: No such stream.

          Best regards
          Andreas

          Andreas added a comment - Hi, thank you for looking into this. I completely forgot to say that before. Enclosed please find the complete folder of a job named "Hello World" including two builds. Build 1 was successful with P4 plugin 1.16.0 and build 2 with P4 plugin version 1.17.0 ended with failure. I have anonymized the data. The output of the "p4 streams" command on the jenkins server is: No such stream. Best regards Andreas

          Jarosław added a comment -

          could you please provide the log that contains the stack trace for the following exception?

          There's not much of a stack trace. The only thing I can see is:

          14:15:33  ERROR: P4: Task Exception: java.lang.RuntimeException: P4JAVA: Error in finding type of stream.java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
          14:15:33  ERROR: Maximum checkout retry attempts reached, aborting 

          Log attached (albeit redacted):.p4_1.17.0_pipeline_failure.log.

          p4 streams returns (same as in andreas_rueger 's case):

          No such stream. 

          We don't use streams at all (as far as I know).

          I'll attach the build.xml and config.xml a bit later if still necessary. Need to anonymise them beforehand.

          Jarosław added a comment - could you please provide the log that contains the stack trace for the following exception? There's not much of a stack trace. The only thing I can see is: 14:15:33  ERROR: P4: Task Exception: java.lang.RuntimeException: P4JAVA: Error in finding type of stream.java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0 14:15:33  ERROR: Maximum checkout retry attempts reached, aborting Log attached (albeit redacted):. p4_1.17.0_pipeline_failure.log . p4 streams returns (same as in andreas_rueger 's case): No such stream. We don't use streams at all (as far as I know). I'll attach the build.xml and config.xml a bit later if still necessary. Need to anonymise them beforehand.

          Dhaval added a comment - - edited

          Thanks andreas_rueger  and jwierzbi . Based on the comments below we have been able to recreate the issue. We will fix it in next release, 1.17.1.

          Workaround till fix is provided: Please create a any stream. Its fine if its empty as well. Then build pipeline will execute. This issue is happening as jenkins is not able to find any stream when running p4 stream command.

          Dhaval added a comment - - edited Thanks andreas_rueger   and jwierzbi . Based on the comments below we have been able to recreate the issue. We will fix it in next release, 1.17.1. Workaround till fix is provided: Please create a any stream. Its fine if its empty as well. Then build pipeline will execute. This issue is happening as jenkins is not able to find any stream when running p4 stream command.

          Andreas added a comment -

          Thank you for the update, Dhaval.

          Andreas added a comment - Thank you for the update, Dhaval.

            Unassigned Unassigned
            andreas_rueger Andreas
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: