serve: zero timeouts busy-spin the epoch thread

Đã đóng
#15,112 2 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

Một pull request liên quan đã được merge.

  • #15143 của @xia-chao — đã merge

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust, wasm
Lĩnh vực
cli, performance

Hướng nghiên cứu

The busy loop is in EpochThread in src/commands/serve.rs, which calls sleep with the epoch interval derived from the timeout near line 746; the loop itself is near line 1263. Reproduce with wasmtime serve -Scli --post-return-timeout 0 and watch CPU use. Done means zero or sub-millisecond timeouts no longer spin the CPU, and the chosen behaviour (reject, clamp, or document) is agreed in the thread.

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

Mô tả

wasmtime serve -W timeout=0 or --post-return-timeout 0 burns 100-220% CPU (same server without the flag: ~5%). A zero timeout makes the epoch interval zero (serve.rs:746), so EpochThread loops on sleep(0) (serve.rs:1263).

Reject zero and sub-millisecond values, clamp the thread interval, or document 0 as "time out immediately"?

Repro: wasmtime serve -Scli --post-return-timeout 0 <component>, then ps -o %CPU -p <pid>.

Ngôn ngữ chính
Rust
Star
18.8k
Fork
1.9k
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
380

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

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 bytecodealliance/wasmtime

Tất cả issue của bytecodealliance/wasmtime

Issue tương tự

Thêm issue về Rust

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.