Native CLI (scriptc.exe) segfaults on a large program that the same release compiles under Node

Đang mở
#3,595 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ó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
12/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Sôi nổi
Công nghệ
nodejs, typescript
Lĩnh vực
compilers

Hướng nghiên cứu

The crash is in the natively compiled CLI bin/scriptc.exe during scriptc coverage and scriptc build, with no reproduction because the app source is private. The entry point to read is packages/cli/src/main.ts, which the reporter ran under Node as a working comparison. Start by building a symbolized CLI and reproducing the crash on a large entry. Done means the native CLI finishes coverage on that entry without SIGSEGV and matches the Node output.

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

Mô tả

The native CLI that the scriptc npm package installs (bin/scriptc.exe, linux-x64-gnu) crashes with SIGSEGV (exit 139) on a large program, before it prints any report. The same release's compiler, run as JavaScript under Node, analyzes and builds the same program without errors.

Environment

  • scriptc 0.4.12 from npm (scriptc with @scriptc/cli-linux-x64-gnu); 0.4.11 from npm crashes the same way.
  • Linux 6.8.0 x86_64, glibc 2.39.
  • Node v24.22.0 for the JavaScript run.

What happens

scriptc coverage crashes with exit 139 and no report:

$ scriptc coverage src/main.ts --print=diagnostics --fail-on=blockers
Segmentation fault (core dumped)

scriptc build of the same entry, with the app's FFI manifest, crashes the same way.

The entry is a terminal app of about 25,000 statements: a TypeScript app on light's native packages. The coverage crash doesn't need its FFI manifest. Smaller entries from the same workspace (41 of light's own coverage entries and 118 of the app's test entries) pass scriptc coverage with the native CLI.

The crash doesn't depend on the stack limit: it also happens under ulimit -s unlimited. The binary is stripped, and gdb shows a shallow stack, so this isn't deep recursion:

Thread 1 "scriptc.exe" received signal SIGSEGV, Segmentation fault.
0x0000000005e3ec38 in ?? ()
#0  0x0000000005e3ec38 in ?? ()
#1  0x0000000002f9e1a7 in ?? ()
#2  0x0000000002ef6c6e in ?? ()
#3  0x0000000002f792c8 in ?? ()
#4  0x00000000040a0037 in ?? ()
#5  0x00000000040a01fc in ?? ()
#6  0x0000000004283b49 in ?? ()
#7  0x0000000004c778af in ?? ()
#8  0x00000000037048ba in ?? ()
#9  0x00000000044b644d in ?? ()
#10 0x0000000003ae2a4f in ?? ()
#11 0x0000000002f8e6ac in ?? ()
#12 0x000000000299830d in ?? ()
#13 0x000000000298cbb1 in ?? ()
#14 __libc_start_call_main (main=0x298c880, argc=4, ...)

What works

The same program compiles when the compiler runs under Node:

  • @scriptc/compiler 0.4.12 from npm, driven by a copy of packages/cli/src/main.ts at v0.4.12: scriptc coverage reports the entry fully static, and scriptc build produces a working executable.
  • A source build of v0.4.11 plus #3504, run with node packages/cli/dist/main.js: scriptc coverage reports 24,873 statements, 100% static.

So the failure seems specific to the natively compiled CLI rather than to the compiler's handling of the program.

Reproducing

The app's sources aren't public yet. I can try to reduce it to a standalone reproduction, or run a build of the CLI with symbols, or with whatever diagnostics would help, if you can point me to one.

Ngôn ngữ chính
TypeScript
Star
6.6k
Fork
216
Merge trung bình
9 giờ 35 phút
Pull request đã merge (30 ngày)
775

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 vercel-labs/scriptc

Tất cả issue của vercel-labs/scriptc

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.