[Windows] `kimi web` exits with 0xC0000409 (FAST_FAIL_STACK_COOKIE_CHECK_FAILURE) — bundled Node 24.15.0 carries the known libuv RtlGetVersion stack overflow

Đang mở Phù hợp với người mới
#5,057 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

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
74/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ệ
node.js, typescript
Lĩnh vực
backend, cli

Hướng nghiên cứu

Đọc .nvmrc và .github/workflows/_native-build.yml để xác nhận phiên bản Node nào được nhúng trong bản dựng native. Kiểm tra các bản sửa lỗi Node và libuv upstream được tham chiếu, sau đó cập nhật phiên bản runtime để các tệp nhị phân Windows có bản sửa lỗi. Hoàn tất khi bản dựng native sử dụng một bản phát hành Node đã được sửa lỗi và sự cố Windows được báo cáo không còn tái hiện.

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

Mô tả

What version of Kimi Code is running?

2.5.2 (native Windows binary, FileVersion 24.15.0, i.e. the bundled Node runtime)

Note: this is not fixed on the current latest. .nvmrc is still 24.15.0 on main and on tag @moonshot-ai/[email protected], and .github/workflows/_native-build.yml builds the SEA with node-version-file: .nvmrc, so every shipped Windows binary carries the vulnerable runtime.

Which open platform/subscription were you using?

kimi-for-coding (managed:kimi-code). The crash is provider-independent — it also happens with a custom OpenAI-compatible provider, because it is in the TCP connect path, not in the model request path.

Which model were you using?

deepseek-v4.1-flash via a custom OpenAI-compatible provider (also reproduced with kimi-for-coding).

What platform is your computer?

Microsoft Windows NT 10.0.26300.0 x64 (Windows 11, build 26300)

What issue are you seeing?

kimi web on Windows dies silently after anywhere from a few minutes to a few hours of normal use:

  • no JS error, no stack trace, no log line in --log-level info output
  • no Windows Error Reporting entry (the process is killed by a fail-fast, so WER never runs)
  • the only trace is the process exit code
exit code 0xC0000409  (STATUS_STACK_BUFFER_OVERRUN)
ExceptionCode   0xC0000409
ExceptionInformation[0] = 0x2   (FAST_FAIL_STACK_COOKIE_CHECK_FAILURE)
Faulting address: kimi.exe+0x21F2189  (__report_gsfailure, int 0x29)

Observed crashes on one machine (2026-11-13), all started with kimi web --port 5090 --host --log-level info:

started died exit code
21:10:37 (official 2.5.2 binary, launched under procdump) 21:50:34 0xC0000409
22:35:35 (2.5.2 from source, Node 24.15.0) 23:31:44 0xC0000409
23:36:46 (same) 23:44:22 0xC0000409

This has been happening consistently for weeks, on both the TUI and kimi web.

What steps can reproduce the bug?

In production it is probabilistic: just run the server and use it normally (the web UI, long sessions, tool calls). It correlates with number of outbound TCP connects, not with any particular request — every connect calls into the vulnerable code path.

The upstream libuv issue (libuv/libuv#5394) has a deterministic reproducer; it crashed 32/80 rounds on Node v24.15.0 on the reporter's machine. On my machine I could not make it fire in 70 runs of that same script — the trigger depends on what value happens to be left in one uninitialized stack slot, so the rate varies by machine/build — but the crash dumps prove the mechanism below.

// repro.mjs — from libuv/libuv#5394
import { createServer } from "node:http";

for (let i = 0; i < 84; i++) {
  const server = createServer((req, res) => {
    req.on("data", () => {});
    req.on("end", () => {
      res.writeHead(200, { "Content-Type": "application/json; charset=utf-8" });
      res.end("{}");
    });
  });
  await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
  const port = server.address().port;
  const res = await fetch(`http://127.0.0.1:${port}/x`, {
    signal: AbortSignal.timeout(30000),
  });
  await res.text();
  await new Promise((resolve, reject) => server.close((e) => (e ? reject(e) : resolve())));
}
for ($r = 1; $r -le 80; $r++) {
  node repro.mjs 2>&1 | Out-Null
  if ($LASTEXITCODE -ne 0) { "round $r crashed: 0x{0:x8}" -f ($LASTEXITCODE -band 0xFFFFFFFFL) }
}
What is the expected behavior?

The server process stays up. If it must fail, it should log something actionable instead of vanishing.

Additional information

Full root cause, confirmed from a procdump -e -ma full-memory dump of the crash:

The crash is a stack-buffer overflow inside libuv, not in kimi code.

  1. In deps/uv/src/win/tcp.c, uv__is_fast_loopback_fail_supported() (renamed uv__windows10_version1709() in libuv 1.52) does:

    OSVERSIONINFOW os_info;          /* 276 bytes, dwOSVersionInfoSize NOT initialized */
    if (!pRtlGetVersion) return 0;
    pRtlGetVersion(&os_info);
    
  2. ntdll!RtlGetVersion branches on the (uninitialized) dwOSVersionInfoSize. If that field happens to equal 0x11c (284, sizeof(RTL_OSVERSIONINFOEXW)), it takes the "EX" path and writes 284 bytes into the 276-byte OSVERSIONINFOW.

  3. In the clang-cl-built Node 24.15.0 frame for uv__tcp_try_connect, os_info sits at [rsp+0xd4] and ends at exactly [rsp+0x1e8] — which is the compiler's /GS cookie slot. The 8 extra bytes land on the cookie:

    [rsp+0x1e8] = 0x0001010000000000
                  ^^ ServicePackMajor = 0
                     ^^ ServicePackMinor = 0
                        ^^ SuiteMask = 0x0100
                           ^^ ProductType = 1 (VER_NT_WORKSTATION)
    
  4. The function returns through __security_check_cookie, the check fails, and __report_gsfailure calls __fastfail(FAST_FAIL_STACK_COOKIE_CHECK_FAILURE) → 0xC0000409. No handler can run; the process is gone.

  5. I reproduced step 2 in isolation (call RtlGetVersion on a 276-byte buffer with dwOSVersionInfoSize = 0x11c): the 8 bytes after the buffer become 00 00 00 00 00 01 01 xx, exactly the value found in the cookie slot in the dump.

  6. Symbolized stack from the dump (with the published node.pdb for v24.15.0):

    __report_gsfailure                        @ .../vcstartup/src/gs/gs_report.c:220
    uv__tcp_try_connect                       @ deps/uv/src/win/tcp.c
    uv_tcp_connect                            @ deps/uv/src/uv-common.c:411
    node::MakeLibuvRequestCallback<uv_connect_t,...>  @ src/req_wrap-inl.h:126
    node::TCPWrap::Connect                    @ src/tcp_wrap.cc:469
    ... v8 FunctionCallback ...
    
  7. Fixed upstream in libuv by initializing the struct — libuv/libuv#5107 (os_info.dwOSVersionInfoSize = sizeof(os_info); os_info.szCSDVersion[0] = L'\0';), cherry-picked into Node via nodejs/node#62561. It is present from Node v24.16.0 onward. I verified deps/uv/src/win/tcp.c per tag:

    Node libuv struct initialized kimi ships it
    v24.15.0 1.51.0 no yes (2.5.2 … 2.6.3)
    v24.20.0 / v24.21.0 / v24.22.0 1.52.1 yes no
    v26.13.1 1.52.1 yes no

    (Node v26.0.0 is also unfixed; the fix landed in 26.5.0. v22.x is latent-but-unobservable because its MSVC frame has a gap before the cookie.)

  8. Because the vulnerable probe runs on every uv_tcp_connect, the rate scales with how many connections the process makes — which is why long-running kimi web sessions with remote UI clients die and short ones usually do not.

Suggested fix: bump .nvmrc to a Node that carries the fix (v24.16.0+, e.g. the latest 24.x LTS line) so the native SEA build embeds a fixed libuv. package.json has engines.node >= 24.15.0, so this needs no other change.

User-side workaround until then: run from source with Node >= 24.16.0 (pnpm dev:server / node --import tsx ./src/main.ts web ...), which is unfixed at 24.15.0 and clean at 24.21.0.

Upstream references:

  • libuv/libuv#5394 — deterministic reproducer + per-version crash rates (open)
  • libuv/libuv#5107 — the fix (merged)
  • nodejs/node#62561 — cherry-pick into Node (v24.16.0)
Ngôn ngữ chính
TypeScript
Star
8.3k
Fork
1.4k
Merge trung bình
12 giờ 6 phút
Pull request đã merge (30 ngày)
596

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 MoonshotAI/kimi-code

Tất cả issue của MoonshotAI/kimi-code

Issue tương tự

Thêm issue về TypeScript

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.