Calling stop() multiple times or log() after stop() can cause errors in StdLogger
Maintainer thường phản hồi trong vòng 4 ngày
Chưa có ai nhận issue này.
- #709 của @ai đó — đã đóng, không merge
Đá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
- 72/100
Hướng nghiên cứu
Bắt đầu trong superbench/common/utils/stdout_logging.py và kiểm tra StdLogger.stop(), log() và StdoutLoggerStream.restore(). Tái hiện cả hai trường hợp trong issue, sau đó xác minh rằng việc gọi lặp lại stop() và log() sau stop() không còn gây ra lỗi tệp đã đóng khi sys.stdout được khôi phục.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What's the issue, what's expected?:
The StdLogger class exhibits problematic behavior when the stop() method is called multiple times consecutively or when the log() method is called after stop() has been executed. In both cases, a ValueError related to operating on a closed file handle occurs.
Specifically:
- Calling
stdout_logger.stop()more than once after the logger has been started and then stopped will raise an error. - Calling
stdout_logger.log()afterstdout_logger.stop()has been called will raise an error.
How to reproduce it?:
For case 1:
( Assume superbench/common/utils/stdout_logging.py is imported )
import sys
# Assume StdLogger and StdoutLoggerStream classes are defined as in the provided code
# ... (paste StdLogger and StdoutLoggerStream classes here if needed for a self-contained example) ...
stdout_logger = StdLogger()
stdout_logger.add_file_handler("test_multi_stop.log")
print("Starting logger...")
stdout_logger.start(rank=0)
print("This output goes to console and file.")
stdout_logger.log("Using log() method.")
print("Stopping logger...")
stdout_logger.stop()
print("Logger stopped.")
print("Attempting to stop logger again...")
# This line is expected to cause a ValueError
try:
stdout_logger.stop()
print("Second stop() call finished unexpectedly without error.")
except ValueError as e:
print(f"Caught expected error on second stop(): {e}")
For case 2:
import sys
# Assume StdLogger and StdoutLoggerStream classes are defined as in the provided code
# ... (paste StdLogger and StdoutLoggerStream classes here if needed for a self-contained example) ...
stdout_logger = StdLogger()
stdout_logger.add_file_handler("test_log_after_stop.log")
print("Starting logger...")
stdout_logger.start(rank=0)
print("This output goes to console and file.")
print("Stopping logger...")
stdout_logger.stop()
print("Logger stopped. sys.stdout should be restored.")
print("Attempting to use log() method after stopping...")
# This line is expected to cause a ValueError
try:
stdout_logger.log("Message after logger should be stopped.")
print("log() call after stop finished unexpectedly without error.")
except ValueError as e:
print(f"Caught expected error on log() after stop: {e}")
print("Direct print() after stop:")
print("This print() should work fine.") # This print() will work because sys.stdout is restored
Log message or shapshot?:
[2025-05-13 07:42:48,716 01e569a1dc86:2066][base.py:182][ERROR] Run benchmark failed - benchmark: nvbandwidth, message: I/O operation on closed file.
superbench: Run benchmark failed - benchmark: nvbandwidth, message: I/O operation on closed file.
[0]: Traceback (most recent call last):
[2025-05-13 07:42:48,717 01e569a1dc86:2066][executor.py:147][ERROR] I/O operation on closed file.
superbench: I/O operation on closed file.
[2025-05-13 07:42:48,717 01e569a1dc86:2066][executor.py:148][ERROR] Executor failed in nvbandwidth.
superbench: Executor failed in nvbandwidth.
[2025-05-13 07:42:49,716 01e569a1dc86:2066][executor.py:251][INFO] Executor is going to execute kernel-launch.
superbench: Executor is going to execute kernel-launch.
[2025-05-13 07:42:49,717 01e569a1dc86:2228][monitor.py:118][INFO] Start monitoring.
superbench: Start monitoring.
[2025-05-13 07:42:49,718 01e569a1dc86:2066][micro_base.py:177][INFO] Execute command - round: 0, benchmark: kernel-launch, command: /opt/superbench/bin/kernel_launch_overhead -w 100 -n 2000000 -i 2000.
superbench: Execute command - round: 0, benchmark: kernel-launch, command: /opt/superbench/bin/kernel_launch_overhead -w 100 -n 2000000 -i 2000.
[2025-05-13 07:42:50,746 01e569a1dc86:2228][device_manager.py:217][WARNING] Get device power limitation failed: Not Supported
superbench: Get device power limitation failed: Not Supported
[2025-05-13 07:43:00,728 01e569a1dc86:2228][device_manager.py:217][WARNING] Get device power limitation failed: Not Supported
superbench: Get device power limitation failed: Not Supported
[2025-05-13 07:43:10,731 01e569a1dc86:2228][device_manager.py:217][WARNING] Get device power limitation failed: Not Supported
superbench: Get device power limitation failed: Not Supported
[0]: Kernel launch overhead - event time: 0.00267 ms
Kernel launch overhead - wall time: 0.00518 ms
[2025-05-13 07:43:17,900 01e569a1dc86:2066][base.py:182][ERROR] Run benchmark failed - benchmark: kernel-launch, message: I/O operation on closed file.
superbench: Run benchmark failed - benchmark: kernel-launch, message: I/O operation on closed file.
[0]: Traceback (most recent call last):
[2025-05-13 07:43:17,901 01e569a1dc86:2066][executor.py:147][ERROR] I/O operation on closed file.
superbench: I/O operation on closed file.
[2025-05-13 07:43:17,901 01e569a1dc86:2066][executor.py:148][ERROR] Executor failed in kernel-launch.
superbench: Executor failed in kernel-launch.
[2025-05-13 07:43:19,755 01e569a1dc86:2066][executor.py:251][INFO] Executor is going to execute gemm-flops.
superbench: Executor is going to execute gemm-flops.
[2025-05-13 07:43:19,756 01e569a1dc86:2244][monitor.py:118][INFO] Start monitoring.
superbench: Start monitoring.
[2025-05-13 07:43:19,761 01e569a1dc86:2066][micro_base.py:177][INFO] Execute command - round: 0, benchmark: gemm-flops, command: /opt/superbench/bin/cutlass_profiler --warmup-iterations=5 --operation=gemm --n=16384 --k=16384 --m=16384 --kernels=cutlass_simt_sgemm_128x128_8x2_*.
superbench: Execute command - round: 0, benchmark: gemm-flops, command: /opt/superbench/bin/cutlass_profiler --warmup-iterations=5 --operation=gemm --n=16384 --k=16384 --m=16384 --kernels=cutlass_simt_sgemm_128x128_8x2_*.
Additional information:
The root cause appears to be that the StdLogger.stop() method calls self.logger_stream.restore() to clean up the stream and restore sys.stdout, but it does not set self.logger_stream to None afterwards.
- Ngôn ngữ chính
- Python
- Star
- 399
- Fork
- 91
- Merge trung bình
- 3 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
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.
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/superbenchmark
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
microsoft/superbenchmark#772 · 1 reaction ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Official Docker image missing `bandwidthTest` binary for mem-bw benchmark in offline environmentsĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
microsoft/superbenchmark#766 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
NVBandwidth benchmark results parsing bugCó thể đã có người làm @NJX-njx đã nhận 241 ngày trước. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
microsoft/superbenchmark#748 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
V0.13.0 Release PlanCó thể làm lại được @guoshzhao đã nhận 353 ngày trước và không có pull request nào đang mở. Đang mở
microsoft/superbenchmark#743 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
microsoft/superbenchmark#721 ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của microsoft/superbenchmark
Issue tương tự
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
awslabs/visual-asset-management-system#937 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Admin member of a research group cannot see the HX2 allocation until they've been added to itĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
follow-up
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 2 ngày