Uploaded image for project: 'Skara'
  1. Skara
  2. SKARA-1316

Review comment on a commit triggers error in CommitCommentsWorkItem

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.0
    • None
    • libraries
    • None

      In a Gitlab MR, it's possible to comment directly on new commits being added to the MR. This seems like a rather unusual thing to do, but just happened recently. When such a comment is added, the CommitCommentsWorkItem will be triggered and try to process this comment as if it was made on a commit in the repo. The problem is that a review commit is usually not present in the target repo, but only the source/fork, so the lookup will fail.

      Here is an example stacktrace:

      java.lang.RuntimeException: Did not find commit with title Review comments for repository jpg-sec/jdk8u-cpu
      at org.openjdk.skara.forge/org.openjdk.skara.forge.gitlab.GitLabRepository.commitWithComment(GitLabRepository.java:397)
      at org.openjdk.skara.forge/org.openjdk.skara.forge.gitlab.GitLabRepository.lambda$recentCommitComments$14(GitLabRepository.java:437)
      at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
      at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
      at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
      at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
      at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
      at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
      at org.openjdk.skara.forge/org.openjdk.skara.forge.gitlab.GitLabRepository.recentCommitComments(GitLabRepository.java:443)
      at org.openjdk.skara.bots.pr/org.openjdk.skara.bots.pr.CommitCommentsWorkItem.run(CommitCommentsWorkItem.java:95)
      at org.openjdk.skara.bot/org.openjdk.skara.bot.BotRunner$RunnableWorkItem.runMeasured(BotRunner.java:190)
      at org.openjdk.skara.bot/org.openjdk.skara.bot.BotRunner$RunnableWorkItem.run(BotRunner.java:146)
      at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
      at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
      at java.base/java.lang.Thread.run(Thread.java:833)

      The problem seems to be in GitlabRepository::recentCommitComments, which requests "note" objects from the last 4 days and then filters for notes about comments on commits. The above mentioned comment matches this filtering. We need to figure out some additional filter that tells the commit comments we care about apart from the ones we don't. Alternatively, we should just discard comments that can't be looked up using the supplied titleToCommit map.

            erikj Erik Joelsson
            erikj Erik Joelsson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: