Skip to content

Commit db596d2

Browse files
committed
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
1 parent 6825aaf commit db596d2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ private boolean setResultInternal(Object result) {
173173
return false;
174174
}
175175
this.result = result;
176-
if (this.resultHandler != null) {
177-
this.resultHandler.handleResult(this.result);
178-
}
176+
}
177+
if (this.resultHandler != null) {
178+
this.resultHandler.handleResult(this.result);
179179
}
180180
return true;
181181
}

0 commit comments

Comments
 (0)