Skip to content

Commit c055723

Browse files
authored
fix(awc): prevent panics in pool drop for h1 connections (#3448)
1 parent d6bdfac commit c055723

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

awc/CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44

5+
- Prevent panics on connection pool drop when Tokio runtime is shutdown early.
56
- Minimum supported Rust version (MSRV) is now 1.75.
67

78
## 3.5.1

awc/src/client/pool.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ where
7676
fn close(&self, conn: ConnectionInnerType<Io>) {
7777
if let Some(timeout) = self.config.disconnect_timeout {
7878
if let ConnectionInnerType::H1(io) = conn {
79-
actix_rt::spawn(CloseConnection::new(io, timeout));
79+
if tokio::runtime::Handle::try_current().is_ok() {
80+
actix_rt::spawn(CloseConnection::new(io, timeout));
81+
}
8082
}
8183
}
8284
}

0 commit comments

Comments
 (0)