SteamTools icon indicating copy to clipboard operation
SteamTools copied to clipboard

GitHub API 请求间歇性 502 + SocketException(10054) 远程强制关闭连接(长请求 ~19s 后断连)

Open bfxh opened this issue 3 months ago • 1 comments

现象

使用 Watt Toolkit 加速 GitHub 时,部分 API 请求间歇性 502 + 连接被强制关闭(重试可恢复,非持续故障)。

证据(Windows 事件日志,.NET Runtime,BD.WTTS)

Category: BD.WTTS.Services.Implementation.RequestLoggingMiddleware
RequestPath: /esengine/DeepSeek-Reasonix/commit/<sha>/status-details
GET https://github.com/esengine/DeepSeek-Reasonix/commit/<sha>/status-details
responded 502 in 19270.2373 ms

System.Net.Http.HttpRequestException: An error occurred while sending the request.
 ---> System.IO.IOException: Unable to read data from the transport connection: 远程主机强迫关闭了一个现有的连接。
 ---> System.Net.Sockets.SocketException (10054): 远程主机强迫关闭了一个现有的连接。

环境

  • Windows 10/11(x64)
  • Watt Toolkit(Steam++)当前最新版(事件日志仅显示 BD.WTTS 命名空间,未含版本号)
  • 复现路径:GitHub 网页/API 调用(commit status-details 类长请求)在加速开启时偶发

分析

  • SocketException (10054) = 远端(代理出口或被代理的 github.com)强制关闭连接——发生在请求发出后 ~19 秒(长请求场景)
  • 长请求(>10s,如 status-details/checks 聚合)更容易触发;短请求正常
  • 怀疑:代理连接池的 keep-alive/超时与上游断开不一致,或出口 IP 被 GitHub 限流后断连

期望

  • 长请求(>15s)不被强制断连;或断连后自动重试 1-2 次再报 502
  • 日志中带上 Watt Toolkit 自身版本号,便于用户上报

(若需我补充抓包/复现步骤,请告知)

bfxh avatar Aug 08 '26 13:08 bfxh

补充信息(2026-08-08 复现第二个实例):

新实例:raw.githubusercontent.com 静态资源也 502(100 秒挂起后断连)

事件日志(.NET Runtime,BD.WTTS,21:37):

RequestPath: /BeyondDimension/SteamTools/develop/res/screenshots/screenshot-windows-gamelist.webp
GET https://raw.githubusercontent.com/BeyondDimension/SteamTools/develop/res/screenshots/screenshot-windows-gamelist.webp
responded 502 in 100533.2404 ms

System.Threading.Tasks.TaskCanceledException: The operation was canceled.
 ---> System.IO.IOException: Unable to read data from the transport connection: 远程主机强迫关闭了 I/O 连接。
 ---> System.Net.Sockets.SocketException: 远程主机强迫关闭了 I/O 连接。

影响面扩展

  • 首次实例(18:07):api.github.com commit status-details,19 秒断连
  • 本次实例(21:37):raw.githubusercontent.com 仓库静态资源,100 秒挂起后断连

两个实例表明 502 不只影响 api.github.com——加速出口对 GitHub 全域(api/raw)的长请求都不可靠,且挂起时间随请求类型变化(19s~100s+)。

额外观察

  • 该请求是 Watt Toolkit 访问自己仓库(BeyondDimension/SteamTools develop 分支)的截图资源——说明问题出在 Watt Toolkit 的出口代理链路(而非被代理站点的特性)
  • 短请求正常、长请求(>10s)间歇断连——怀疑连接池 keep-alive 或出口限速

复现环境

  • Windows 11 x64
  • 加速模式:GitHub(默认代理模式)
  • 频率:间歇性(重试通常成功)

如需我提供抓包(Wireshark 会话)或 Watt Toolkit 版本信息,请告知(当前日志未记录版本号)。

bfxh avatar Aug 08 '26 14:08 bfxh