# MongoServerError: balancer round trip time exceeded 30 seconds: chunk migration timed out for range

- **ID:** `mongodb/balancer-round-trip-timeout`
- **Domain:** mongodb
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 78%

## Root Cause

Chunk migration between shards failed due to network latency or overloaded source shard, exceeding the 30-second round-trip threshold.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| mongodb 6.0 | active | — | — |
| mongodb 7.0 | active | — | — |
| mongodb 8.0 | active | — | — |

## Workarounds

1. **Temporarily disable the balancer to allow pending migrations to complete: `sh.stopBalancer(10000)` then re-enable after monitoring network latency between shards.** (75% success)
   ```
   Temporarily disable the balancer to allow pending migrations to complete: `sh.stopBalancer(10000)` then re-enable after monitoring network latency between shards.
   ```
2. **Increase chunk size to reduce migration frequency: `db.adminCommand({ setClusterParameter: { chunkSize: 128 } })` and ensure source shard has sufficient I/O capacity.** (82% success)
   ```
   Increase chunk size to reduce migration frequency: `db.adminCommand({ setClusterParameter: { chunkSize: 128 } })` and ensure source shard has sufficient I/O capacity.
   ```
3. **Use `db.adminCommand({ moveChunk: 'mydb.mycoll', find: { shardKey: value }, to: 'targetShard', maxTimeMS: 60000 })` to manually migrate chunks with a longer timeout after verifying network health.** (85% success)
   ```
   Use `db.adminCommand({ moveChunk: 'mydb.mycoll', find: { shardKey: value }, to: 'targetShard', maxTimeMS: 60000 })` to manually migrate chunks with a longer timeout after verifying network health.
   ```

## Dead Ends

- **** — The timeout is caused by underlying network or resource issues, not stale balancer state; restarting only delays recovery and may lose migration progress. (90% fail)
- **** — The round-trip timeout is a hard-coded balancer limit, not a client-side query timeout; adjusting maxTimeMS does not affect internal balancer logic. (95% fail)
- **** — Stopping all chunk migrations leads to data imbalance, reduced query performance, and eventual cluster instability. (80% fail)
