Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] JGit - constant 100% CPU usage in MyersDiff

On our internal Gerrit system I found out that Gerrit process is constantly using 100% of CPU.
Using Gerrit 2.1.5.

Using "top -H" and creating several thread dumps I found that the java thread that is
consuming the CPU is always doing something in MyersDiff class.

Here a few examples from a few thread dumps:
"HTTP-23" prio=10 tid=0x00007f084c6c2800 nid=0x2cf8 runnable [0x00007f084b5ea000]
   java.lang.Thread.State: RUNNABLE
        at org.eclipse.jgit.diff.MyersDiff$MiddleEdit$ForwardEditPaths.snake(MyersDiff.java:439)
        at org.eclipse.jgit.diff.MyersDiff$MiddleEdit$EditPaths.calculate(MyersDiff.java:394)
        at org.eclipse.jgit.diff.MyersDiff$MiddleEdit.calculate(MyersDiff.java:240)
        at org.eclipse.jgit.diff.MyersDiff.calculateEdits(MyersDiff.java:168)
        at org.eclipse.jgit.diff.MyersDiff.calculateEdits(MyersDiff.java:155)
        at org.eclipse.jgit.diff.MyersDiff.<init>(MyersDiff.java:130)
        at com.google.gerrit.server.patch.PatchListCacheImpl$Loader.newEntry(PatchListCacheImpl.java:345)
        at com.google.gerrit.server.patch.PatchListCacheImpl$Loader.newEntry(PatchListCacheImpl.java:323)
        at com.google.gerrit.server.patch.PatchListCacheImpl$Loader.readPatchList(PatchListCacheImpl.java:257)
        at com.google.gerrit.server.patch.PatchListCacheImpl$Loader.createEntry(PatchListCacheImpl.java:180)
        at com.google.gerrit.server.patch.PatchListCacheImpl$Loader.createEntry(PatchListCacheImpl.java:166)
        at com.google.gerrit.server.cache.PopulatingCache$1.createEntry(PopulatingCache.java:55)
...

...some minutes later...
"HTTP-23" prio=10 tid=0x00007f084c6c2800 nid=0x2cf8 runnable [0x00007f084b5ea000]
   java.lang.Thread.State: RUNNABLE
        at org.eclipse.jgit.diff.MyersDiff$MiddleEdit$EditPaths.getX(MyersDiff.java:306)
        at org.eclipse.jgit.diff.MyersDiff$MiddleEdit$BackwardEditPaths.meets(MyersDiff.java:513)
        at org.eclipse.jgit.diff.MyersDiff$MiddleEdit$EditPaths.calculate(MyersDiff.java:425)
        at org.eclipse.jgit.diff.MyersDiff$MiddleEdit.calculate(MyersDiff.java:240)
        at org.eclipse.jgit.diff.MyersDiff.calculateEdits(MyersDiff.java:168)
        at org.eclipse.jgit.diff.MyersDiff.calculateEdits(MyersDiff.java:155)
        at org.eclipse.jgit.diff.MyersDiff.<init>(MyersDiff.java:130)
        at com.google.gerrit.server.patch.PatchListCacheImpl$Loader.newEntry(PatchListCacheImpl.java:345)
        at com.google.gerrit.server.patch.PatchListCacheImpl$Loader.newEntry(PatchListCacheImpl.java:323)
        at com.google.gerrit.server.patch.PatchListCacheImpl$Loader.readPatchList(PatchListCacheImpl.java:257)
        at com.google.gerrit.server.patch.PatchListCacheImpl$Loader.createEntry(PatchListCacheImpl.java:180)
        at com.google.gerrit.server.patch.PatchListCacheImpl$Loader.createEntry(PatchListCacheImpl.java:166)
...

"HTTP-23" prio=10 tid=0x00007f084c6c2800 nid=0x2cf8 runnable [0x00007f084b5ea000]
   java.lang.Thread.State: RUNNABLE
        at org.eclipse.jgit.diff.MyersDiff$MiddleEdit$EditPaths.calculate(MyersDiff.java:425)
        at org.eclipse.jgit.diff.MyersDiff$MiddleEdit.calculate(MyersDiff.java:240)
        at org.eclipse.jgit.diff.MyersDiff.calculateEdits(MyersDiff.java:168)
        at org.eclipse.jgit.diff.MyersDiff.calculateEdits(MyersDiff.java:155)
        at org.eclipse.jgit.diff.MyersDiff.<init>(MyersDiff.java:130)
        at com.google.gerrit.server.patch.PatchListCacheImpl$Loader.newEntry(PatchListCacheImpl.java:345)
        at com.google.gerrit.server.patch.PatchListCacheImpl$Loader.newEntry(PatchListCacheImpl.java:323)
        at com.google.gerrit.server.patch.PatchListCacheImpl$Loader.readPatchList(PatchListCacheImpl.java:257)
        at com.google.gerrit.server.patch.PatchListCacheImpl$Loader.createEntry(PatchListCacheImpl.java:180)
        at com.google.gerrit.server.patch.PatchListCacheImpl$Loader.createEntry(PatchListCacheImpl.java:166)
        at com.google.gerrit.server.cache.PopulatingCache$1.createEntry(PopulatingCache.java:55)
...


"HTTP-23" prio=10 tid=0x00007f084c6c2800 nid=0x2cf8 runnable [0x00007f084b5ea000]
   java.lang.Thread.State: RUNNABLE
        at org.eclipse.jgit.diff.MyersDiff$MiddleEdit$BackwardEditPaths.snake(MyersDiff.java:481)
        at org.eclipse.jgit.diff.MyersDiff$MiddleEdit$EditPaths.calculate(MyersDiff.java:394)
        at org.eclipse.jgit.diff.MyersDiff$MiddleEdit.calculate(MyersDiff.java:240)
        at org.eclipse.jgit.diff.MyersDiff.calculateEdits(MyersDiff.java:168)
        at org.eclipse.jgit.diff.MyersDiff.calculateEdits(MyersDiff.java:155)
        at org.eclipse.jgit.diff.MyersDiff.<init>(MyersDiff.java:130)
        at com.google.gerrit.server.patch.PatchListCacheImpl$Loader.newEntry(PatchListCacheImpl.java:345)
        at com.google.gerrit.server.patch.PatchListCacheImpl$Loader.newEntry(PatchListCacheImpl.java:323)
        at com.google.gerrit.server.patch.PatchListCacheImpl$Loader.readPatchList(PatchListCacheImpl.java:257)
        at com.google.gerrit.server.patch.PatchListCacheImpl$Loader.createEntry(PatchListCacheImpl.java:180)
        at com.google.gerrit.server.patch.PatchListCacheImpl$Loader.createEntry(PatchListCacheImpl.java:166)
        at com.google.gerrit.server.cache.PopulatingCache$1.createEntry(PopulatingCache.java:55)


It is already more than an hour since the first thread dump and the CPU usage is still 100%
and the top -H shows the same thread at the top.

Looks like an infinite loop somewhere in MyersDiff?

Sasa Zivkov


Back to the top