提交 972d8bad 编写于 作者: J Jesse Glick

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

[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.
上级 78742488
......@@ -61,6 +61,9 @@ Upcoming changes</a>
<li class=bug>
Optimizations in fingerprint recording.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16301">issue 16301</a>)
<li class='major bug'>
Errors searching build records when builds were misordered.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-15652">issue 15652</a>)
<li class=bug>
User icon in People broken if Jenkins root URL unconfigured.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-18118">issue 18118</a>)
......
......@@ -439,8 +439,8 @@ public abstract class AbstractLazyLoadRunMap<R> extends AbstractMap<Integer,R> i
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) {
......@@ -451,8 +451,8 @@ public abstract class AbstractLazyLoadRunMap<R> extends AbstractMap<Integer,R> i
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) {
......@@ -491,7 +491,7 @@ public abstract class AbstractLazyLoadRunMap<R> extends AbstractMap<Integer,R> i
// 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.NoSuchElementException;
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 class AbstractLazyLoadRunMapTest extends Assert {
assert x.n==201;
}
@Ignore("proper fix TBD")
@Bug(15652)
@Test public void outOfOrder() throws Exception {
FakeMap map = localBuilder
......@@ -273,7 +271,7 @@ public class AbstractLazyLoadRunMapTest extends Assert {
.add(11, "2013-E")
.make();
map.entrySet(); // forces Index to be populated
map.search(3, Direction.DESC);
assertNull(map.search(3, Direction.DESC));
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册