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.
--timeout=<sec>: This is the primary setting for HTTP/FTP connections. It defines the number of seconds of inactivity before a connection is considered timed out. The default value is usually 60 seconds.--bt-tracker-timeout=<sec>: Specifically for BitTorrent, this setting determines how many seconds aria2 will wait for a response from a BitTorrent tracker before giving up.--lowest-speed-limit=<speed>: A highly effective way to close “stalled” connections that aren’t technically dead but are downloading painfully slowly. If the download speed stays below this limit for a specified time, aria2 drops the connection.
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.
- Locate your
aria2.conffile (typically found in~/.config/aria2/aria2.confon Linux/macOS or in the same directory as the executable on Windows). - Open the file in a text editor.
- 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- Save and close the file. The next time you launch aria2, it will automatically apply these aggressive timeout thresholds to clear out stalled connections.