docmirror/dev-sidecar · warning
[speed] test by TCP timeout:
Error message
[speed] test by TCP timeout:
What it means
SpeedTester's testByTCP opens a raw TCP connection to a candidate host:port to measure latency/availability. If the connection doesn't complete within the timeout window, the pending test is rejected with Error('timeout') and this warning is logged with the target, DNS source, and elapsed cost. The failed IP will score badly and lose the speed-test selection.
Source
Thrown at packages/mitmproxy/src/lib/speed/SpeedTester.js:258
clearTimeout(timeoutId)
const connectionTime = Date.now()
resolve({ status: 'success', by: 'TCP', target: `${host}:${this.port}`, time: connectionTime - startTime })
client.end()
})
client.on('error', (e) => {
isOver = true
clearTimeout(timeoutId)
log.warn('[speed] test by TCP error: ', this.hostname, `➜ ${host}:${this.port} from DNS '${dns}', cost: ${Date.now() - startTime} ms, errorMsg:`, e.message)
reject(e)
client.destroy()
})
timeoutId = setTimeout(() => {
if (!isOver) {
isOver = true
log.warn('[speed] test by TCP timeout:', this.hostname, `➜ ${host}:${this.port} from DNS '${dns}', cost: ${Date.now() - startTime} ms`)
reject(new Error('timeout'))
client.destroy()
}
}, timeout)
})
}
// 暂不使用
// testByPing (item) {
// return new Promise((resolve, reject) => {
// const { host, dns } = item
// const startTime = Date.now()
//
// // 设置超时程序
// let isOver = false
// const timeout = 5000
// const timeoutId = setTimeout(() => {
// if (!isOver) {View on GitHub (pinned to 7710cd56cc)
Solutions
- Increase the speed test timeout in config (speed test timeout option) if your network is high latency (e.g. mobile/VPN).
- Prune unreachable or blocked IPs from your pre-set ip lists so they aren't repeatedly tested.
- Check local firewall/VPN rules that silently drop (rather than reject) TCP SYN packets to the tested ports.
- Ignore occasional timeouts — the tester is designed to reject slow endpoints and pick better IPs automatically.
Example fix
// before
"speedTest": { "timeout": 2000 }
// after
"speedTest": { "timeout": 5000 } Defensive patterns
Strategy: retry
Try / catch
try { await speedTester.testOne(ip, port) } catch (e) { if (e.message === 'timeout') markIpUnavailable(ip) } Prevention
- Set a generous speed-test timeout for high-latency networks
- Remove known-blocked IPs from candidate lists
- Check firewall rules that silently drop SYN packets
- Treat occasional timeouts as normal selection signal, not an outage
When it happens
Trigger: testOne -> testByTCP against an IP whose TCP port doesn't respond within `timeout` ms — blocked by firewall, filtered by GFW, dead server, or a very slow route; the socket neither connects nor errors before the timer fires.
Common situations: Testing candidate IPs for github/docker domains from networks where those IPs are blocked; IPv6 addresses on IPv4-only networks; extremely congested links; timeout configured too low for high-latency mobile networks.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- [speed] test by TCP error:
- [speed] test error: ${this.hostname} ➜ ${item.host}:${this
- 下载远程配置成功,但内容为空:
- 下载远程 domestic-domain-allowlist.txt 文件成功,但内容为空或内容太短,判断为无效的 do
- IPv6 地址 ${ip} 多次不可达(ENETUNREACH),已自动禁用 IPv6 DNS 解析
AI-assisted analysis of docmirror/dev-sidecar@7710cd56cc (2026-08-31).
Data as JSON: /api/errors/e1e3dc2f893a55df.
Report an issue: GitHub.