Skip to content
Permalink
Browse files

[FIXED JENKINS-15652] “Solving” errors by just return null from ALLRM…

….search and reducing to one-line warnings. @kohsuke confirms that the intent of throwing AIOOBE was to track down definite code errors; but in at least some known occurrences of this bug, the problem is invalid data: build records on disk with <number>s that are duplicated and/or out of order. Since that violates the precondition of the class, we do not pretend to successfully search for such records. At some point it would make sense to have the code detect anomalous conditions and initiate a builds folder cleanup. Take only the last build of a given number, and discard any earlier with higher number. I.e. just set <number> to 0 or something and ignore such builds, or rename build.xml to build-broken.xml.

Cherry-picked-from: 972d8ba
  • Loading branch information
jglick authored and kohsuke committed May 28, 2013
1 parent b6b760b commit 2af3d15442547bb0d3ddd13fd2af10c33beef258
@@ -438,8 +438,8 @@ public R search(final int n, final Direction d) {
String msg = String.format(
"JENKINS-15652 Assertion error #1: failing to load %s #%d %s: lo=%d,hi=%d,size=%d,size2=%d",
dir, n, d, lo, hi, idOnDisk.size(), initialSize);
LOGGER.log(Level.WARNING, msg,new Exception());
throw new ArrayIndexOutOfBoundsException(msg);
LOGGER.log(Level.WARNING, msg);
return null;
}

while (lo<hi) {
@@ -450,8 +450,8 @@ public R search(final int n, final Direction d) {
String msg = String.format(
"JENKINS-15652 Assertion error #2: failing to load %s #%d %s: lo=%d,hi=%d,pivot=%d,size=%d (initial:lo=%d,hi=%d,size=%d)",
dir, n, d, lo, hi, pivot, idOnDisk.size(), initialLo, initialHi, initialSize);
LOGGER.log(Level.WARNING, msg,new Exception());
throw new ArrayIndexOutOfBoundsException(msg);
LOGGER.log(Level.WARNING, msg);
return null;
}
R r = load(idOnDisk.get(pivot), null);
if (r==null) {
@@ -490,7 +490,7 @@ public R search(final int n, final Direction d) {
// but don't let this kill the loading the hard way
LOGGER.log(Level.WARNING, String.format(
"JENKINS-15652 Assertion error #3: failing to load %s #%d %s: lo=%d,hi=%d,size=%d (initial:lo=%d,hi=%d,size=%d)",
dir, n,d,lo,hi,idOnDisk.size(), initialLo,initialHi,initialSize),new Exception());
dir, n,d,lo,hi,idOnDisk.size(), initialLo,initialHi,initialSize));
return null;
}
return getById(idOnDisk.get(lo-1));
@@ -35,7 +35,6 @@
import java.util.SortedMap;
import java.util.logging.Level;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.jvnet.hudson.test.Bug;

/**
@@ -253,7 +252,6 @@ public void indexOutOfBounds() throws Exception {
assert x.n==201;
}

@Ignore("proper fix TBD")
@Bug(15652)
@Test public void outOfOrder() throws Exception {
FakeMap map = localBuilder
@@ -273,7 +271,7 @@ public void indexOutOfBounds() throws Exception {
.add(11, "2013-E")
.make();
map.entrySet(); // forces Index to be populated
map.search(3, Direction.DESC);
assertNull(map.search(3, Direction.DESC));
}

}

0 comments on commit 2af3d15

Please sign in to comment.
You can’t perform that action at this time.