[Bug]: trtllm-bench reads past --num_requests and can block on pipes

Đang mở
#23,244 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@JunkaiWang-TheoPhy đang làm issue này rồi.

Từ ngày 2/12/2026.

  • #23245 của @JunkaiWang-TheoPhy — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
backend, testing

Hướng nghiên cứu

Start by reading create_dataset_from_stream in tensorrt_llm/bench/utils/data.py and the throughput and low-latency benchmark callers described in the issue. Check how the loader orders its request limit check and readline() call, then run the supplied StringIO reproduction and the relevant loader tests. Done means it returns after collecting the requested record, leaves the next record unread, and does not block on an open pipe; linked pull request #23245 is already open.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

System Info

TensorRT-LLM main at ef375f87565b89a5818e705c735ec59a182efb86. Reproduced on macOS ARM64 with Python 3.12 using the actual CPU dataset loader and Pydantic request models. Native package initialization was bypassed locally. No GPU, model weights, tokenizer encoding, or live inference is needed to exercise the loader.

Reproduction

The throughput and low-latency benchmark commands use create_dataset_from_stream to load their --dataset with the configured --num_requests. Run this in a TensorRT-LLM Python environment:

from io import StringIO

from tensorrt_llm.bench.utils.data import create_dataset_from_stream

first = '{"task_id":0,"input_ids":[1,2],"output_tokens":8}\n'
second = '{"task_id":1,"input_ids":[1,2],"output_tokens":8}\n'
stream = StringIO(first + second)
metadata, requests = create_dataset_from_stream(None, stream, num_requests=1)

assert metadata.num_requests == 1
assert [request.task_id for request in requests] == [0]
assert stream.readline() == second
Expected behavior

Stop reading as soon as the requested number of records has been collected. The second record should remain unread.

Actual behavior

The final assertion fails because the second record was consumed and the stream is at EOF. In a separate OS-pipe reproduction, the loader attempted a second read after receiving its only requested record and remained blocked until the still-open writer was closed.

Additional notes

The loop checks the result of stream.readline() before checking the request limit. If the check happens first, the loader can return without waiting for an unneeded row or EOF. Searches for create_dataset_from_stream plus readline, and for benchmark stdin hangs involving num_requests, did not find an existing issue or fix.

OpenAI Codex assisted with finding and validating this issue.

Ngôn ngữ chính
Python
Star
15.2k
Fork
3k
Merge trung bình
2 ngày 21 giờ
Pull request đã merge (30 ngày)
477

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của NVIDIA/TensorRT-LLM

Tất cả issue của NVIDIA/TensorRT-LLM

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.