提交 313fb594 编写于 作者: K Kohsuke Kawaguchi

[FIXED JENKINS-9349] let GZipInputStream release its native memory

eagerly.
上级 92709ae1
......@@ -63,6 +63,9 @@ Upcoming changes</a>
<div id="rc" style="display:none;"><!--=BEGIN=-->
<h3><a name=v1.438>What's new in 1.438</a> <!--=DATE=--></h3>
<ul class=image>
<li class=bug>
Fixed random OutOfMemoryError with console annotations
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-9349">issue 9349</a>)
<li class=bug>
Repeated ids, expandTextArea() and multiple "Invoke Ant" build steps.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-10989">issue 10989</a>)
......
......@@ -121,10 +121,14 @@ public class AnnotatedLargeText<T> extends LargeText {
ObjectInputStream ois = new ObjectInputStreamEx(new GZIPInputStream(
new CipherInputStream(new ByteArrayInputStream(Base64.decode(base64.toCharArray())),sym)),
Jenkins.getInstance().pluginManager.uberClassLoader);
long timestamp = ois.readLong();
if (TimeUnit2.HOURS.toMillis(1) > abs(System.currentTimeMillis()-timestamp))
// don't deserialize something too old to prevent a replay attack
return (ConsoleAnnotator)ois.readObject();
try {
long timestamp = ois.readLong();
if (TimeUnit2.HOURS.toMillis(1) > abs(System.currentTimeMillis()-timestamp))
// don't deserialize something too old to prevent a replay attack
return (ConsoleAnnotator)ois.readObject();
} finally {
ois.close();
}
}
} catch (GeneralSecurityException e) {
throw new IOException2(e);
......
......@@ -222,7 +222,11 @@ public abstract class ConsoleNote<T> implements Serializable, Describable<Consol
ObjectInputStream ois = new ObjectInputStreamEx(
new GZIPInputStream(new ByteArrayInputStream(buf)), Jenkins.getInstance().pluginManager.uberClassLoader);
return (ConsoleNote) ois.readObject();
try {
return (ConsoleNote) ois.readObject();
} finally {
ois.close();
}
} catch (Error e) {
// for example, bogus 'sz' can result in OutOfMemoryError.
// package that up as IOException so that the caller won't fatally die.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册