Browse Source

Fix deadlock issue in DeferredResult

Previously DeferredResult locked around the setting of the result
including handling up to the part of submitting a dispatch. This
can cause a deadlock if a timeout occurs at the same time since
the Tomcat timeout thread has its own locking that permits only
one thread to do timeout or dispatch processing.

The fix reduces the locking to cover only the attempt to set the
DeferredResult but not the dispatching.

Issue: SPR-10485
pull/282/merge
Rossen Stoyanchev 13 years ago
parent
commit
25701ef984
  1. 6
      spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResult.java

6
spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResult.java

@ -173,9 +173,9 @@ public class DeferredResult<T> { @@ -173,9 +173,9 @@ public class DeferredResult<T> {
return false;
}
this.result = result;
if (this.resultHandler != null) {
this.resultHandler.handleResult(this.result);
}
}
if (this.resultHandler != null) {
this.resultHandler.handleResult(this.result);
}
return true;
}

Loading…
Cancel
Save