Skip to content

fix: force 4 tokio worker threads on client#11

Merged
mickvandijke merged 1 commit intoWithAutonomi:mainfrom
jacderida:fix/force-4-worker-threads
Mar 30, 2026
Merged

fix: force 4 tokio worker threads on client#11
mickvandijke merged 1 commit intoWithAutonomi:mainfrom
jacderida:fix/force-4-worker-threads

Conversation

@jacderida
Copy link
Copy Markdown
Contributor

Summary

  • Force worker_threads = 4 on the tokio runtime regardless of CPU count
  • Add .cargo/config.toml to .gitignore

On small client VMs (1-2 vCPU), the default num_cpus gives only 1-2 worker threads. The NAT traversal poll() function does synchronous work (parking_lot locks, DashMap iteration) that blocks its worker thread. With only 1 worker, this freezes the entire runtime — timers stop, keepalives can't fire, and connections die silently, causing upload hangs.

Test plan

  • Tested on 6-node testnet (5 cloud + 1 local behind NAT) for 60 minutes
  • 43 consecutive successful uploads, 0 failures
  • No deadlocks or process hangs

🤖 Generated with Claude Code

The default #[tokio::main] uses num_cpus worker threads. On small
client VMs (1-2 vCPU), this gives only 1-2 worker threads. The NAT
traversal poll() function does synchronous work (parking_lot locks,
DashMap iteration) that blocks its worker thread. With only 1 worker,
this freezes the entire runtime — timers stop, keepalives can't fire,
and connections die silently, causing upload hangs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mickvandijke mickvandijke merged commit b9c08d6 into WithAutonomi:main Mar 30, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants