Community
Participate
Working Groups
Created attachment 283228 [details] Java snippet to reproduce problem When using JGit concurrently in the same application, JGit often fails with the following error: java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.CompletableFuture$AsyncSupply@41727a4c rejected from java.util.concurrent.ThreadPoolExecutor@1f27645f[Running, pool size = 5, active threads = 5, queued tasks = 0, completed tasks = 0] at java.util.concurrent.CompletableFuture.asyncSupplyStage(CompletableFuture.java:1604) at java.util.concurrent.CompletableFuture.supplyAsync(CompletableFuture.java:1830) at org.eclipse.jgit.util.FS$FileStoreAttributes.getFileStoreAttributes(FS.java:329) at org.eclipse.jgit.util.FS$FileStoreAttributes.get(FS.java:296) at org.eclipse.jgit.util.FS.getFileStoreAttributes(FS.java:767) at org.eclipse.jgit.internal.storage.file.FileSnapshot.<init>(FileSnapshot.java:224) at org.eclipse.jgit.internal.storage.file.FileSnapshot.<init>(FileSnapshot.java:205) at org.eclipse.jgit.internal.storage.file.FileSnapshot.save(FileSnapshot.java:102) at org.eclipse.jgit.internal.storage.file.FileRepository.<init>(FileRepository.java:209) at org.eclipse.jgit.storage.file.FileRepositoryBuilder.build(FileRepositoryBuilder.java:55) at Reproducer.lambda$null$0(Reproducer.java:21) This worked fine until 5.6.1.202002131546-r and started failing on later versions, so I believe this is a regression. I've attached a small Java snippet to reproduce the problem. Note that it requires an existing working directory of a Git repository to be passed as an argument. Also, it's not completely reliable in reproducing the problem. Disabling JIT compilation in the JVM ('-Xint' for OpenJDK) to change the performance characteristics increased the chances of hitting the problem for me.
I believe that this is possibly a regression that was introduced by the following change. Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=551690 Gerrit: https://git.eclipse.org/r/153691 Commit: http://git.eclipse.org/c/jgit/jgit.git/commit/?id=64715a189fe19e8a25bb8757591e3ef60f3f9aa8 It introduced a new ThreadPoolExecutor FUTURE_RUNNER in org.eclipse.jgit.util.FS$FileStoreAttributes (instead of using the common ForkJoinPool). FUTURE_RUNNER uses SynchronousQueue, that doesn't queue requests, with a maximum pool size of 5. This limits the number of concurrent usages of JGit in the same JVM process to the magic number of 5.
New Gerrit change created: https://git.eclipse.org/r/164901
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/166767
Gerrit change https://git.eclipse.org/r/c/jgit/jgit/+/166767 was merged to [master]. Commit: http://git.eclipse.org/c/jgit/jgit.git/commit/?id=097f01bfb65dd8f7b3d562bbd1713ecf4be5675e
*** Bug 566938 has been marked as a duplicate of this bug. ***