Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[node-core-library] SubprocessTerminator ignores SIGHUP, so detached children outlive a closed terminal

Đang mở Phù hợp với người mới
#6,124 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
75/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, operating-systems

Hướng nghiên cứu

Bắt đầu bằng cách đọc SubprocessTerminator trong package @rushstack/node-core-library, đặc biệt là _ensureInitialized và _cleanupChildProcesses được issue nêu tên. Kiểm tra hành vi SIGINT/SIGTERM hiện có và các bài kiểm thử tương ứng, sau đó xác minh rằng SIGHUP được xử lý và dọn dẹp trên các hệ thống không phải Windows. Hoàn tất khi trường hợp tái hiện không còn để tiến trình con đã tách chạy tiếp sau khi đóng terminal hoặc khi nhận SIGHUP.

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

Mô tả

🤖 Filed by GitHub Copilot acting for @namankanakiya (light review only).

Package: @rushstack/node-core-library 5.25.1. Linux/macOS (non-Windows).

Repro: script.js:

const { SubprocessTerminator } = require('@rushstack/node-core-library');
const c = require('child_process').spawn('sleep', ['1000'], SubprocessTerminator.RECOMMENDED_OPTIONS);
SubprocessTerminator.killProcessTreeOnExit(c, SubprocessTerminator.RECOMMENDED_OPTIONS);
setInterval(() => {}, 1000);

Run it in a terminal, then close the terminal (or kill -HUP <pid>).

Observed: sleep keeps running with ppid 1. RECOMMENDED_OPTIONS (detached: true) puts the child in its own session, so the terminal's hangup never reaches it, and killProcessTreeOnExit only handles SIGINT, SIGTERM and exit. With SIGINT or SIGTERM the child is killed as expected.

Expected: on non-Windows, SIGHUP is handled like SIGINT/SIGTERM, so closing the terminal of a tool that uses SubprocessTerminator does not leak its detached children.

Suggested fix: in _ensureInitialized, also process.prependListener('SIGHUP', _onTerminateSignal), and remove it in _cleanupChildProcesses.

Happy to test a candidate fix.

Ngôn ngữ chính
TypeScript
Star
6.5k
Fork
710
Merge trung bình
1 ngày 13 giờ
Pull request đã merge (30 ngày)
45

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

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

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 microsoft/rushstack

Tất cả issue của microsoft/rushstack

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.