Skip to content

fix: force 4 tokio worker threads on node#46

Open
jacderida wants to merge 1 commit intoWithAutonomi:mainfrom
jacderida:fix/force-4-worker-threads
Open

fix: force 4 tokio worker threads on node#46
jacderida wants to merge 1 commit intoWithAutonomi:mainfrom
jacderida:fix/force-4-worker-threads

Conversation

@jacderida
Copy link
Collaborator

Summary

  • Force worker_threads = 4 on the tokio runtime regardless of CPU count
  • Remove !.cargo/config.toml exception from .gitignore

On small 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.

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

Copilot AI review requested due to automatic review settings March 26, 2026 20:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The default #[tokio::main] uses num_cpus worker threads. On small
node 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.

Also removes the !.cargo/config.toml exception from .gitignore so
local-only patch overrides stay out of version control.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jacderida jacderida force-pushed the fix/force-4-worker-threads branch from f10ac95 to e66d372 Compare March 26, 2026 21:07
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