How to Change aria2 Stalled Connection Timeout?

To prevent slow or frozen downloads from wasting system resources, aria2 allows users to customize how long the client waits before dropping a stalled connection. By configuring specific command-line flags or updating your configuration file, you can modify the timeout thresholds for connections that have stopped transferring data. This guide covers the exact parameters you need to change—specifically --bt-tracker-timeout, --timeout, and --lowest-speed-limit—and demonstrates how to apply them via the terminal or a permanent configuration file to optimize your download efficiency.

Key aria2 Parameters for Handling Stalled Connections

aria2 provides a few distinct settings to control timeouts, depending on whether you are downloading standard files (HTTP/FTP) or using BitTorrent. Adjusting these values ensures that the client quickly drops unresponsive peers or servers and moves on to healthier sources.

Method 1: Changing Timeout via Command Line

If you are running a one-off download and want to adjust the timeout duration immediately, you can pass the timeout flags directly into your terminal command.

To set the connection timeout to 30 seconds and the tracker timeout to 15 seconds, use the following structure:

aria2c --timeout=30 --bt-tracker-timeout=15 "your_download_url_or_torrent"

If you also want to drop connections that drop below a download speed of 10KB/s for more than 30 seconds, you can combine it with the lowest speed limit flag:

aria2c --timeout=30 --lowest-speed-limit=10K "your_download_url_or_torrent"

Method 2: Making the Changes Permanent via Configuration File

For regular users, modifying the aria2 configuration file (aria2.conf) is the most efficient approach, as it applies your preferred timeout rules to every download automatically.

  1. Locate your aria2.conf file (typically found in ~/.config/aria2/aria2.conf on Linux/macOS or in the same directory as the executable on Windows).
  2. Open the file in a text editor.
  3. Add or modify the following lines to your preference:
# Set max time to wait for a stalled connection (in seconds)
timeout=30

# Set max time to wait for BitTorrent trackers (in seconds)
bt-tracker-timeout=15

# Drop connections if speed is below 10K for more than 30 seconds
lowest-speed-limit=10K
  1. Save and close the file. The next time you launch aria2, it will automatically apply these aggressive timeout thresholds to clear out stalled connections.