Skip to content

Commit 2a031b6

Browse files
authored
Add a pool timeout to try to fix open File descriptor issue like deno (#2205)
Theres no pool technically but i saw this on Deno as well so we can try this out. <!-- ELLIPSIS_HIDDEN --> ---- > [!IMPORTANT] > Set pool parameters in `builder()` in `mod.rs` to prevent stalling, inspired by similar issues in Deno and other projects. > > - **Behavior**: > - In `builder()` in `mod.rs`, set `pool_max_idle_per_host(0)` and `pool_idle_timeout(Duration::from_nanos(1))` to prevent stalling in Python. > - References issues in `reqwest`, `deno`, `hyper`, and `azure-sdk-for-rust` for context. > - **Comments**: > - Updated comments in `builder()` to explain the rationale for pool settings and link to related issues. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=BoundaryML%2Fbaml&utm_source=github&utm_medium=referral)<sup> for 9bcb5cf. You can [customize](https://app.ellipsis.dev/BoundaryML/settings/summaries) this summary. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN -->
1 parent 07fc23f commit 2a031b6

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

  • engine/baml-runtime/src/request

engine/baml-runtime/src/request/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ fn builder() -> reqwest::ClientBuilder {
1414
.connect_timeout(Duration::from_secs(10))
1515
.danger_accept_invalid_certs(danger_accept_invalid_certs)
1616
.http2_keep_alive_interval(Some(Duration::from_secs(10)))
17-
// We don't want to keep idle connections around due to sometimes
18-
// causing a stall in the connection pool across FFI boundaries
17+
// To prevent stalling in python, we set the pool to 0 and idle timeout to 0.
18+
// See:
1919
// https://github.com/seanmonstar/reqwest/issues/600
20+
// https://github.com/denoland/deno/issues/28853
21+
// https://github.com/hyperium/hyper/issues/2312
22+
// https://github.com/Azure/azure-sdk-for-rust/pull/1550
2023
.pool_max_idle_per_host(0)
21-
24+
.pool_idle_timeout(std::time::Duration::from_nanos(1))
2225
}
2326
}
2427
}

0 commit comments

Comments
 (0)