Uploaded image for project: 'FishEye'
  1. FishEye
  2. FE-6783

NPE's during indexing P4 repo

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Medium
    • 4.4.2, 4.5.0
    • 3.10.0, 4.3.0
    • None

    Description

      Summary

      When indexing a Perforce repository, the repository fails to index due to a NullPointerException.

      Steps to Reproduce

      File used in the reproduction is attached to this ticket.

      1. Create a P4 repository and add a file with 10 lines, each ending with LF (represented by $):
        $ p4 print //depot/10lines.txt@1 | cat -e
        //depot/10lines.txt#1 - add change 1 (xtext)$
        line 1$
        line 2$
        line 3$
        line 4$
        line 5$
        line 6$
        line 7$
        line 8$
        line 9$
        line 10${noformat}
        
         # Modify file to add a line that contains {{CR}} characters (represented by {{^M}}), followed by a line that starts with "====", followed by another added line:
        

        $ p4 print //depot/10lines.txt@2 | cat -e
        //depot/10lines.txt#2 - edit change 2 (xtext)$
        line 1$
        line 2$
        line 3$
        after line 3^Mcomes a line^Mwith some CR signs$
        ==== followed by a line that starts with many '=' signs$
        line 4$
        line 5$
        line 6$
        after line 6 comes a normal line$
        line 7$
        line 8$
        line 9$
        line 10${noformat}

      1. Allow FishEye to index

      Expected Results

      Indexing of the repository completes successfully.

      Actual Results

      Indexing fails with an NPE:

      2017-07-13 12:37:45,284 DEBUG [InitPing2 mixed_eol ] fisheye P4Exec-getProcessStatusMessage - Exception processing P4 command - returning as status
      com.atlassian.utils.process.ProcessException: java.lang.NullPointerException
              at com.atlassian.utils.process.ExternalProcessImpl.handleHandlerError(ExternalProcessImpl.java:273) [atlassian-processutils-1.5.14.jar:?]
              at com.atlassian.utils.process.ExternalProcessImpl.access$300(ExternalProcessImpl.java:18) [atlassian-processutils-1.5.14.jar:?]
              at com.atlassian.utils.process.ExternalProcessImpl$3.doTask(ExternalProcessImpl.java:317) [atlassian-processutils-1.5.14.jar:?]
              at com.atlassian.utils.process.LatchedRunnable.run(LatchedRunnable.java:36) [atlassian-processutils-1.5.14.jar:?]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_60]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_60]
              at java.lang.Thread.run(Thread.java:745) [?:1.8.0_60]
      Caused by: java.lang.NullPointerException
              at com.cenqua.fisheye.io.IOHelper.write(IOHelper.java:307) [fisheye.jar:?]
              at com.cenqua.fisheye.rep.DiffTextCache.addLine(DiffTextCache.java:168) [fisheye.jar:?]
              at com.cenqua.fisheye.perforce.client.DescribeProcessor.processRCSOutput(DescribeProcessor.java:351) [fisheye.jar:?]
              at com.cenqua.fisheye.perforce.client.DescribeProcessor.processChangeLine(DescribeProcessor.java:151) [fisheye.jar:?]
              at com.cenqua.fisheye.perforce.client.DescribeProcessor.processLine(DescribeProcessor.java:143) [fisheye.jar:?]
              at com.cenqua.fisheye.perforce.client.P4OutputLineProcessor.processOutput(P4OutputLineProcessor.java:45) [fisheye.jar:?]
              at com.cenqua.fisheye.perforce.client.P4Exec$3.process(P4Exec.java:193) [fisheye.jar:?]
              at com.atlassian.utils.process.PluggableProcessHandler.processOutput(PluggableProcessHandler.java:127) [atlassian-processutils-1.5.14.jar:?]
              at com.cenqua.fisheye.util.NamedProcessHandler.processOutput(NamedProcessHandler.java:31) [fisheye.jar:?]
              at com.atlassian.utils.process.ExternalProcessImpl$3.doTask(ExternalProcessImpl.java:315) [atlassian-processutils-1.5.14.jar:?]
              ... 4 more
      2017-07-13 12:37:45,285 WARN  [InitPing2 mixed_eol ] fisheye BaseRepositoryScanner-handleSlurpException - Problem processing revisions from repository mixed_eol (mixed_eol) due to class com.cenqua.fisheye.perforce.client.P4ClientException - [localhost:6001//depot] Problem executing describe -dn 2: com.atlassian.utils.process.ProcessException:java.lang.NullPointerException
      com.cenqua.fisheye.perforce.client.P4ClientException: [localhost:6001//depot] Problem executing describe -dn 2: com.atlassian.utils.process.ProcessException:java.lang.NullPointerException
              at com.cenqua.fisheye.perforce.client.P4Client.addChangesInformation(P4Client.java:430) [fisheye.jar:?]
              at com.cenqua.fisheye.perforce.client.P4Client.getChangeLists(P4Client.java:159) [fisheye.jar:?]
              at com.cenqua.fisheye.perforce.P4Scanner.slurpRevisionBlock(P4Scanner.java:193) [fisheye.jar:?]
              at com.cenqua.fisheye.perforce.P4Scanner.processRevisions(P4Scanner.java:1193) [fisheye.jar:?]
              at com.cenqua.fisheye.rep.LifecycleRepositoryScanner.slurpRepository(LifecycleRepositoryScanner.java:83) [fisheye.jar:?]
              at com.cenqua.fisheye.rep.LifecycleRepositoryScanner.doSlurpTransaction(LifecycleRepositoryScanner.java:50) [fisheye.jar:?]
              at com.cenqua.fisheye.perforce.P4Scanner.doSlurpTransaction(P4Scanner.java:1076) [fisheye.jar:?]
              at com.cenqua.fisheye.rep.BaseRepositoryScanner.ping(BaseRepositoryScanner.java:73) [fisheye.jar:?]
              at com.cenqua.fisheye.rep.BaseRepositoryEngine.doSlurp(BaseRepositoryEngine.java:85) [fisheye.jar:?]
              at com.cenqua.fisheye.rep.RepositoryEngine.slurp(RepositoryEngine.java:419) [fisheye.jar:?]
              at com.cenqua.fisheye.rep.ping.IndexingPingRequest.doRequest(IndexingPingRequest.java:28) [fisheye.jar:?]
              at com.cenqua.fisheye.rep.ping.IncrementalPingRequest.doRequest(IncrementalPingRequest.java:30) [fisheye.jar:?]
              at com.cenqua.fisheye.rep.ping.PingRequest$1.run(PingRequest.java:55) [fisheye.jar:?]
              at com.cenqua.fisheye.util.NamedExecution.run(NamedExecution.java:27) [fisheye.jar:?]
              at com.cenqua.fisheye.rep.ping.PingRequest.process(PingRequest.java:52) [fisheye.jar:?]
              at com.cenqua.fisheye.rep.RepositoryHandle.processPingRequests(RepositoryHandle.java:211) [fisheye.jar:?]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_60]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_60]
              at java.lang.Thread.run(Thread.java:745) [?:1.8.0_60]
      

      As part of this fix, an extra log message was added to tell which line caused the problem:

      2017-07-13 12:37:45,283 ERROR [184:StdOutHandler mixed_eol ] fisheye P4OutputLineProcessor-processOutput - Exception while processing P4 output, line 19: after line 6 comes a normal line

      Workaround

      Set a start revision that is higher than the changeset which cannot be indexed.

      Fix

      This fix may not work on Windows.

      This problem is caused by FishEye wrongly splitting P4 output on any of LF, CR and CRLF, while in fact it should only split the output on the line separator specific to the environment it's running in.

      The fix changes the previous behaviour and to avoid any unpleasant surprises, it will be initially hidden behing a feature flag. To use the new functionality:

      1. use FishEye version at least as new as the one described in "Fix Version" field
      2. start FishEye with the following JVM system property:
        fisheye.p4.use.system.line.separator=true
      1. re-index the repository (to save time, you can first try configuring this repository under a temporary name and setting "Start Revision" to the value printed in the log)

      Attachments

        1. 10lines.txt_r1
          0.1 kB
        2. 10lines.txt_r2
          0.2 kB
        3. p4_workshop.log
          12 kB

        Issue Links

          Activity

            People

              kcichy Kamil Cichy
              glewandowski Grzegorz Lewandowski
              Votes:
              8 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: