tsc-ts server segfaults (libc memcpy, fault address just past 4 GiB) on large programs; CLI reports only "unexpected end of stream"
Maintainer thường phản hồi trong vòng 1 ngà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
- 42/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ệ
- typescript
- Lĩnh vực
- backend, performance
Hướng nghiên cứu
Start with the tsc-ts server checking path and the API protocol transport; the report identifies a repeatable synthetic reproduction in repro.mjs with about 5,400 functions. Run the provided scriptc coverage --coverage=reached repro.mjs command and compare against the passing 5,200-function case. Done means the server handles the large program without crashing and the CLI reports a server crash clearly if the helper exits mid-protocol.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
tsc-ts (the TypeScript 7 API server, [email protected]) dies with SIGSEGV while checking programs above a size/complexity threshold. The kernel log shows a memcpy (rep movsb) fault in libc.so.6 at addresses just past 4 GiB, which looks like a 32-bit offset/index truncation in a large buffer rather than OOM. The CLI survives, but reports only TypeScript API protocol: unexpected end of stream — nothing names the crashed server or that it crashed at all.
Environment
- scriptc 0.4.17 and 0.4.16 (identical behavior; not a 0.4.17 regression),
@scriptc/cli-linux-x64-gnu - Ubuntu, kernel 6.x, x86_64, glibc
- Reproduced with the stock npm toolchain layout
Reproduction (synthetic, no dependencies)
A file of ~5,400 small functions crosses the threshold; ~5,200 does not:
node -e 'for(let i=0;i<5400;i++)console.log(`function fn${i}(a,b){const x${i}=a+b*${i};if(x${i}>${i})return x${i}-${i};return[x${i},a,b];}`);console.log("console.log(fn0(1,2));")' > repro.mjs
scriptc coverage --coverage=reached repro.mjs
# → scriptc: TypeScript API protocol: unexpected end of stream (exit 1)
Observed boundary (same function shape, only the count varied; several runs each):
| functions | size | result |
|---|---|---|
| 4,880 | ~576 KB | passes |
| 5,200 | ~613 KB | passes |
| 5,400 | ~636 KB | server segfaults, repeatable |
The trigger is neither raw bytes nor statement/function count alone, since these all pass:
- 5,300 "tiny" functions (1 statement each, 204 KB total)
- 2,000 "fat" functions (~34k statements, 537 KB total)
- 5,300 medium functions of slightly different shapes (~543–558 KB total)
It looks like total checker workload (AST + type instantiation size) crossing a ~4 GiB internal boundary.
Kernel evidence
One line per crash, consistent across inputs; the fault address always sits just above 0x1_0000_0000 (the offset past 4 GiB varies with input size, the 4 GiB base does not):
tsc-ts[pid]: segfault at 0x10b800040 ip 00007f… in libc.so.6 … error 6
tsc-ts[pid]: segfault at 0x113000040 …
tsc-ts[pid]: segfault at 0x10c000000 …
tsc-ts[pid]: segfault at 0x117400000 …
error 6 = write fault during rep movsb (glibc memcpy).
Real-world trigger
A 4.3 MB minified ESM bundle chunk (effect/schema output of a rolldown build, analyzed with its runtime closure) crashes the same way on scriptc build, run, and coverage. Happy to share the chunk privately or attach it if useful.
Relationship to existing reports
Distinct from #3468 (coverage SIGSEGV of the CLI itself on TS-source package exports) and from #3595 (the native scriptc.exe CLI itself crashing): here the CLI process survives and the tsc-ts server is what dies, which the kernel log confirms by name. The similar large-program character of #3595 suggests they could share a runtime/backend root cause, but the crash site and observable behavior differ.
What would help
- Root cause: a >4 GiB indexing/allocation bug reachable during checking. The synthetic repro above is deterministic and self-contained, so it should be bisectable.
- Independently of the root cause: when the server dies mid-protocol, the CLI should say so.
unexpected end of streamreads as a protocol corruption, not a crashed helper; the transport knows the server's pid and can probe it. I'm preparing a small PR for this part.
- Ngôn ngữ chính
- TypeScript
- Star
- 6.7k
- Fork
- 229
- Merge trung bình
- 14 giờ 29 phút
- Pull request đã merge (30 ngày)
- 787
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọ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 vercel-labs/scriptc
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
vercel-labs/scriptc#4865 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
vercel-labs/scriptc#4864 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Windows ARM64 as a cross-compile targetCó thể đã có người làm @hum-n đã nhận 1 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
vercel-labs/scriptc#4858 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
post-merge-bisect-unresolved
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 43/100
vercel-labs/scriptc#4791 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
post-merge-bisect-unconfirmed
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 12/100
vercel-labs/scriptc#4755 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của vercel-labs/scriptc
Issue tương tự
-
bug data-types
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
ClickHouse/clickhouse-js#1293 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: middleware enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
agent/quality testing
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 92/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
juspay/agent-distro#203 ·
Maintainer thường phản hồi trong vòng 1 ngày