Skip to content

Commit b9c08d6

Browse files
authored
Merge pull request #11 from jacderida/fix/force-4-worker-threads
fix: force 4 tokio worker threads on client
2 parents c63f546 + 47cfa97 commit b9c08d6

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/target
2+
.cargo/config.toml
23
.claude/plans/

ant-cli/src/main.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@ use ant_core::data::{
1515
};
1616
use cli::{Cli, Commands};
1717

18-
#[tokio::main]
18+
/// Force at least 4 worker threads regardless of CPU count.
19+
///
20+
/// On small VMs (1-2 vCPU), the default `num_cpus` gives only 1-2 worker
21+
/// threads. The NAT traversal poll() function does synchronous work
22+
/// (parking_lot locks, DashMap iteration) that blocks its worker thread.
23+
/// With only 1 worker, this freezes the entire runtime — timers stop,
24+
/// keepalives can't fire, and connections die silently.
25+
#[tokio::main(flavor = "multi_thread", worker_threads = 4)]
1926
async fn main() {
2027
let code = match run().await {
2128
Ok(()) => 0,

0 commit comments

Comments
 (0)