~EThread does not close its eventfd or pipe, leaking descriptors per TSThreadCreate/TSThreadDestroy

Đang mở Phù hợp với người mới
#14,199 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 2 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
82/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, linux
Lĩnh vực
backend, operating-systems

Hướng nghiên cứu

Đọc phần thiết lập eventfd/pipe trong src/iocore/eventsystem/UnixEThread.cc khoảng dòng 100–141 và vòng đời của luồng chuyên dụng trong src/api/InkIOCoreAPI.cc khoảng dòng 92 và 215. Kiểm tra cách các descriptor được khởi tạo và giá trị nào cho biết chúng đã được mở, sau đó xác minh rằng khi hủy, các descriptor tương ứng được đóng. Hoàn thành khi việc tạo và hủy luồng plugin lặp lại không còn để các descriptor đó mở.

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

Mô tả

Bug Core Event System Leak Threads TS API

EThread(ThreadType, int) opens an eventfd (or, without eventfd, a pipe) for waking the thread (https://github.com/apache/trafficserver/blob/eeeada36e1dff81822977bc36016d4264d64cdb8/src/iocore/eventsystem/UnixEThread.cc#L100-L122). ~EThread releases the thread mutex but never closes evfd or evpipe (https://github.com/apache/trafficserver/blob/eeeada36e1dff81822977bc36016d4264d64cdb8/src/iocore/eventsystem/UnixEThread.cc#L132-L141).

Most event threads live for the whole process, but INKThreadInternal, which backs the plugin thread API, is constructed with EThread(DEDICATED, -1) (https://github.com/apache/trafficserver/blob/eeeada36e1dff81822977bc36016d4264d64cdb8/src/api/InkIOCoreAPI.cc#L92), so every TSThreadCreate or TSThreadInit opens a descriptor (two for the pipe), and TSThreadDestroy deletes the object (https://github.com/apache/trafficserver/blob/eeeada36e1dff81822977bc36016d4264d64cdb8/src/api/InkIOCoreAPI.cc#L215) without closing them. A plugin that creates and destroys threads repeatedly (for example plugins/experimental/magick, https://github.com/apache/trafficserver/blob/eeeada36e1dff81822977bc36016d4264d64cdb8/plugins/experimental/magick/magick.cc#L111) leaks one descriptor per thread until it hits the fd limit.

Suggested fix: close evfd / evpipe[0..1] in ~EThread when they were opened. A dedicated thread may not need a wakeup descriptor at all.


generated with Claude Opus 5.5 by Josiah VanderZee

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

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 apache/trafficserver

Tất cả issue của apache/trafficserver

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.