Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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 5fea6cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelog.html
Expand Up @@ -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=-->

Expand Down
8 changes: 6 additions & 2 deletions core/src/main/java/hudson/diagnosis/OldDataMonitor.java
Expand Up @@ -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());
Expand Down

0 comments on commit 5fea6cb

Please sign in to comment.