提交 5fea6cb5 编写于 作者: J Jesse Glick

[FIXED JENKINS-24358] RunSaveableReference.get can acquire locks, so avoid...

[FIXED JENKINS-24358] RunSaveableReference.get can acquire locks, so avoid calling it while holding a lock on ourselves.
上级 e22ff9e9
...@@ -58,6 +58,9 @@ Upcoming changes</a> ...@@ -58,6 +58,9 @@ Upcoming changes</a>
<li class=rfe> <li class=rfe>
Added 'no-store' to the 'Cache-Control' header to avoid accidental information leak through local cache backup Added 'no-store' to the 'Cache-Control' header to avoid accidental information leak through local cache backup
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-24337">issue 24337</a>) (<a href="https://issues.jenkins-ci.org/browse/JENKINS-24337">issue 24337</a>)
<li class=bug>
Deadlock in <code>OldDataMonitor</code>.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-24358">issue 24358</a>)
</ul> </ul>
</div><!--=TRUNK-END=--> </div><!--=TRUNK-END=-->
......
...@@ -84,9 +84,13 @@ public class OldDataMonitor extends AdministrativeMonitor { ...@@ -84,9 +84,13 @@ public class OldDataMonitor extends AdministrativeMonitor {
return !data.isEmpty(); return !data.isEmpty();
} }
public synchronized Map<Saveable,VersionRange> getData() { public Map<Saveable,VersionRange> getData() {
Map<SaveableReference,VersionRange> _data;
synchronized (this) {
_data = new HashMap<SaveableReference,VersionRange>(this.data);
}
Map<Saveable,VersionRange> r = new HashMap<Saveable,VersionRange>(); Map<Saveable,VersionRange> r = new HashMap<Saveable,VersionRange>();
for (Map.Entry<SaveableReference,VersionRange> entry : data.entrySet()) { for (Map.Entry<SaveableReference,VersionRange> entry : _data.entrySet()) {
Saveable s = entry.getKey().get(); Saveable s = entry.getKey().get();
if (s != null) { if (s != null) {
r.put(s, entry.getValue()); r.put(s, entry.getValue());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册