Skip to content

Commit 71354a8

Browse files
shawkinsmanusa
authored andcommitted
fix: moving source close to the executor (just like doConsume)
close: #6354 Signed-off-by: Steve Hawkins <[email protected]> Signed-off-by: Marc Nuri <[email protected]>
1 parent 928d356 commit 71354a8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#### Bugs
66
* Fix #6247: Support for proxy authentication from proxy URL user info
77
* Fix #6342: UnmatchedFieldTypeModule prevents certain jackson features from working
8+
* Fix #6354: Prevent deadlock in okhttp AsyncBody.cancel
89

910
### 6.13.3 (2024-08-13)
1011

httpclient-okhttp/src/main/java/io/fabric8/kubernetes/client/okhttp/OkHttpClientImpl.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ public CompletableFuture<Void> done() {
151151

152152
@Override
153153
public void cancel() {
154-
Utils.closeQuietly(source);
154+
// closing from a non dispatcher thread risks deadlock because close is
155+
// a long-running operation that may need to re-obtain the dispatcher lock
156+
// and the thread may already be holding other locks
157+
executor.execute(() -> Utils.closeQuietly(source));
155158
done.cancel(false);
156159
}
157160
}

0 commit comments

Comments
 (0)