Pool deadlock: all resources allocated crash#4528
Conversation
Increase pool size from 10 to 20 and timeout from 60s to 120s to reduce the likelihood of pool exhaustion under heavy concurrent request load. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request aims to resolve a deadlock crash by increasing the HTTP connection pool size and timeout. The change is a direct mitigation for the reported issue. My review focuses on a potential configuration mismatch between the pool size and the underlying HTTP client's maxConnectionsPerHost setting. I've suggested an adjustment to align these values for more predictable behavior and easier debugging of concurrency issues.
|
|
||
| _client = IOClient(httpClient); | ||
| _pool = Pool(10, timeout: const Duration(seconds: 60)); | ||
| _pool = Pool(20, timeout: const Duration(seconds: 120)); |
There was a problem hiding this comment.
While increasing the pool size is a good step towards mitigating the deadlock, there's a configuration mismatch that could lead to subtle issues.
The Pool size is being increased to 20, but the underlying HttpClient is still configured with maxConnectionsPerHost = 15 (on line 19). If all concurrent requests from the pool target the same host, the HttpClient will become the bottleneck, queuing any requests beyond the 15th. This makes the Pool's limit of 20 misleading and can complicate debugging.
For more predictable performance and clearer control over concurrency, these two limits should be aligned. I suggest setting the pool size to 15 to match maxConnectionsPerHost. This still provides a 50% increase in concurrency over the original value of 10.
If a concurrency of 20 is a hard requirement, please consider also increasing maxConnectionsPerHost to 20 in a subsequent change.
| _pool = Pool(20, timeout: const Duration(seconds: 120)); | |
| _pool = Pool(15, timeout: const Duration(seconds: 120)); |
Both the HTTP client connection limit and the pool size should match to avoid the pool allowing more concurrent requests than connections available. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
Crash Stats
Test plan
🤖 Generated with Claude Code