From d439c8dfe5ec521fc0f66cf956d9a5c7e63cadd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Ar=C3=A8s?= Date: Thu, 5 Jun 2014 15:16:26 -0400 Subject: [PATCH] Fix DeltaTask infinite loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DeltaTask$Block.partitionTask was doing an infinite loop if number of threads was greater than the totalWeight. The weightPerThread was 0 which was causing the infinite loop. Set the weightPerThread to a minimal value of one. Bug: 420915 Change-Id: Ia8e3ad956d53d8193937b7fa1bc19aafde9767ff Signed-off-by: Hugo Arès --- .../src/org/eclipse/jgit/internal/storage/pack/DeltaTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaTask.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaTask.java index c4b01949d..9534053bf 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaTask.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaTask.java @@ -121,7 +121,7 @@ final class DeltaTask implements Callable { ArrayList topPaths = computeTopPaths(); Iterator topPathItr = topPaths.iterator(); int nextTop = 0; - long weightPerThread = totalWeight / threads; + long weightPerThread = Math.max(totalWeight / threads, 1); for (int i = beginIndex; i < endIndex;) { DeltaTask task = new DeltaTask(this); long w = 0;