Skip to content
Permalink
Browse files

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

…avoid calling it while holding a lock on ourselves.
  • Loading branch information
jglick committed Aug 20, 2014
1 parent e22ff9e commit 5fea6cb52c8a5f6323f1744ad20dbaa66d92e6ba
Showing with 9 additions and 2 deletions.
  1. +3 −0 changelog.html
  2. +6 −2 core/src/main/java/hudson/diagnosis/OldDataMonitor.java
@@ -58,6 +58,9 @@
<li class=rfe>
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>)
<li class=bug>
Deadlock in <code>OldDataMonitor</code>.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-24358">issue 24358</a>)
</ul>
</div><!--=TRUNK-END=-->

@@ -84,9 +84,13 @@ public boolean isActivated() {
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>();
for (Map.Entry<SaveableReference,VersionRange> entry : data.entrySet()) {
for (Map.Entry<SaveableReference,VersionRange> entry : _data.entrySet()) {
Saveable s = entry.getKey().get();
if (s != null) {
r.put(s, entry.getValue());

0 comments on commit 5fea6cb

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