Skip to content

新版上传有bug #122

Closed
Closed

Description

@yjd

服务端: librespeed-rs 1.4.0
客户端: librespeed-cli-v1.0.12 librespeed-cli-v1.0.13

相同环境下测试结果:

Image


测试参数:

echo '[{"id": 1,"name": "a","server": "http://xxx/backend/","dlURL": "garbage","ulURL": "empty","pingURL": "empty","getIpURL": "getIP"}]' | ./librespeed-cli --server 1 -4 --local-json - --concurrent 1 --no-download

Activity

  1. maddie commented on Aug 11, 2026

    @maddie
    Collaborator

    分析结论(已核对代码并本地复现):

    现象:同一服务器,v1.0.12 上传 1040.07 Mbps,v1.0.13 仅 0.55 Mbps。

    根因:v1.0.13 重构了上传逻辑(commit 9fc41f4):v1.0.12 是单请求无限循环发送 payload;v1.0.13 改为每个请求只发送固定 uploadSize 字节、完成后通过 uploadDone 触发新请求。当服务器处理/响应行为与这个模型不匹配时(例如响应时机、连接复用),后续请求不会持续发出,导致总字节数极小。

    当前状态:master 已合入 #123(修复了字节计数器数据竞争、上传结束时不等在途请求就读数、管道下无输出等问题),但未改变上述请求模型。我用 Go/Python 测试服务器本地复现均正常(v1.0.13 与 master 一致),说明依赖 librespeed-rs 的具体行为。

    建议:

    1. 请用最新 master 构建(或下个 release)重测同一服务器,附 --debug 输出(含 `Upload test starting/finished` 与实际发送字节数)。
    2. 若仍复现,请提供 librespeed-rs 的上传端处理方式(是否流式响应/何时关闭连接),便于定位请求未续发的具体环节。
  2. yjd commented on Aug 11, 2026

    @yjd
    Author

    1, 请用最新 master 构建(或下个 release)// 最新编译版哪里下载?
    2, 服务端使用版本 https://github.com/librespeed/speedtest-rust/releases/tag/v1.4.0

    使用配置

    # bind socket adress
    bind_address="::"
    # socket listent port, default is 8080
    listen_port=80
    
    # you can specify the number of worker threads. default is 1
    # auto: number of cpu cores, or more than 0 as desired
    # increasing the count increases memory usage
    worker_threads=1
    
    # base api url /{base_url}/routes
    base_url="backend"
    
    # ipinfo.io API key, If the api-key works, the priority is with the api, if not with the offline database
    ipinfo_api_key=""
    
    # set directory of speedtest web front to server load on `/`. If it is empty, default web will be returned
    assets_path="./assets" # Write without suffix separator
    
    # password for logging into statistics page, fill this to enable stats page
    stats_password=""
    
    # redact IP addresses
    redact_ip_addresses=false
    
    # set telemetry result image theme : light, dark
    # default is light
    result_image_theme="light"
    
    # database config for : mysql, postgres, sqlite, memory, or disable by write none
    # after restarting the service, the in-memory database is reset
    # if none is specified, no telemetry/stats will be recorded, and no result JPG will be generated
    database_type="sqlite"
    database_hostname="localhost"
    database_name="speedtest_db"
    database_username=""
    database_password=""
    # if you use `sqlite` as database, set database_file to database file location
    database_file="speedtest.db"
    
    # enable and use TLS option; if enable it, you need to prepare certificates and private keys
    enable_tls=false
    tls_cert_file=""
    tls_key_file=""
    
  3. maddie commented on Aug 17, 2026

    @maddie
    Collaborator

    duplicate of #42

  4. maddie commented on Aug 17, 2026

    @maddie
    Collaborator

    更新:根因已完全定位并修复(两端)。

    根因:客户端上传 body 经 io.TeeReader 计数后无法探测长度,Go 自动改用 Transfer-Encoding: chunked;librespeed-rs 的手写 HTTP 解析器不解码 chunked,按固定 1024 字节块读原始流,有限 payload 发完后差几个字节凑不满块、客户端 keep-alive 不关连接 → 服务器永久阻塞不响应 → 请求永不完成 → 上传只发一个 payload(1 MiB / 15s ≈ 0.55 Mbps)。

    修复:

    1. 客户端 fix: send Content-Length on upload requests instead of chunked #143 + fix: set upload Content-Length to the payload size, not the KiB option #144:上传请求显式发送 Content-Length(按 payload 实际大小,1024 KiB 选项 → 1 MiB),所有后端通用。
    2. 服务端 fix: decode Transfer-Encoding: chunked request bodies speedtest-rust#50:Chunked 分支按 RFC 9112 §7.1 真正解码 chunked(待上游合并)。

    实测:修复后的客户端 + 修复后的 rust 后端,回环上传 23192 Mbps(修复前 0.55 Mbps);chunked 上传从挂起变为 ~1ms 响应。

  5. yjd commented on Aug 17, 2026

    @yjd
    Author

    @maddie 收到,谢谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions