[Engine] 0.1.73 (v0.2.25): --serve without --expert-profile segfaults in the adaptive tier on the first request (host_res is empty)

Đang mở Phù hợp với người mới
#7,777 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

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

Chưa có ai nhận issue này.

Đá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
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp
Lĩnh vực
backend, performance

Hướng nghiên cứu

Bắt đầu tại engine/src/program/generate.cpp, ở điều kiện adaptive-tier được báo cáo quanh dòng 15138; sau đó đọc adapt() quanh dòng 15502 và phần thiết lập graph_hits/profile quanh dòng 11124. Tái hiện lỗi với --expert-cache và không có --expert-profile, rồi kiểm tra điều kiện --expert-profile-save hiện có để xác định cách xử lý profile như mong đợi. Hoàn tất khi cùng yêu cầu đó không còn gây segfault và trường hợp thiếu profile được xử lý bằng thông báo rõ ràng hoặc giữ cho quá trình thích ứng ở trạng thái tắt.

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

Mô tả

Version: Strata v0.2.25, engine 0.1.73-metal (the released binary; also a self-built one from the v0.2.25 tag)
Hardware: Mac Studio, Apple M5 Ultra, 96 GB unified memory, macOS 27

What happens

A hand-written run config that has --expert-cache N but no --expert-profile starts fine, then the engine dies with SIGSEGV on the first request (the server answers 503):

strata metal: crashed (signal 11 at address 0x0) - the call stack:
0   strata   metal_crash + 64
1   libsystem_platform.dylib   _sigtramp + 56
2   strata   std::__thread_proxy<... main::$_341> + 104
Repro

The released engine with a Qwen3.8-Flash-Next IQ3_S pack, the usual arguments minus --expert-profile:

--pack <pack> --native <shard1> --ple-gguf <shard2> --expert-cache 64 --prefill auto --max-context 262144 --mmap-experts

Any chat request then crashes it. Adding --expert-profile terminal/data/expert-profile.bin (or --adapt-swaps 0) makes it run.

Cause

With a RelWithDebInfo build and the faulting pc from the signal context, the crash is in adapt() at engine/src/program/generate.cpp:15502 (v0.2.25):

const int32_t* r = host_res.data() + l * g.n_expert;
...
if (r[e] < 0) {            // host_res is empty -> null read
  • host_res is only built when graph_hits is true, and graph_hits needs !profile.empty() (line 11124).
  • The adaptive tier is switched on at line 15138 without looking at it:
    if (o.adapt_every > 0 && o.adapt_swaps > 0 && !all_experts_resident && live_gpu_slots > 0) drive.d.usage.assign(...)
    (all_experts_resident is false when host_res is empty).
  • So with no profile and a cache of at least one slot, the first adapt round reads a null table.

--expert-profile-save already checks for this case (drive.d.usage.empty() || host_res.empty() -> "needs ... --expert-profile"), the tier itself does not.

Suggested fix

Either && !host_res.empty() on line 15138 (the tier stays off, one log line saying it needs --expert-profile), or refuse the start with that message. setup never hits this because it always passes a profile (the neutral one for other shapes), so it only bites hand-written configs.

Ngôn ngữ chính
C++
Star
11.6k
Fork
1k
Merge trung bình
6 ngày 2 giờ
Pull request đã merge (30 ngày)
21

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 Niko1221/Strata

Tất cả issue của Niko1221/Strata

Issue tương tự

Thêm issue về C++

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.