~EThread does not close its eventfd or pipe, leaking descriptors per TSThreadCreate/TSThreadDestroy
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- cpp, linux
- Domain
- backend, operating-systems
Research direction
Read the eventfd/pipe setup in src/iocore/eventsystem/UnixEThread.cc around lines 100–141 and the dedicated thread lifecycle in src/api/InkIOCoreAPI.cc around lines 92 and 215. Check how the descriptors are initialized and which values indicate they were opened, then verify destruction closes the applicable descriptors. Done when repeated plugin thread creation and destruction no longer leaves those descriptors open.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- C++
- Stars
- 2k
- Forks
- 903
- Avg merge
- 4d 4h
- Merged PRs (30d)
- 135
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/trafficserver
-
UnixNetVConnection::do_io_write with a null reader leaves the previous reader in the write VIOPossibly taken @NginxL claimed this today. OpenBug Good First Issue IOBuffer Network
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/trafficserver#14220 ·
Maintainers usually reply within 2 days
-
MallocAllocator does not check for allocation failurePossibly taken @umrndem claimed this today. OpenBug Core Good First Issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/trafficserver#14218 · 2 comments ·
Maintainers usually reply within 2 days
-
Bug Event System Threads
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/trafficserver#14217 ·
Maintainers usually reply within 2 days
-
TSContScheduleEveryOnPool and TSContScheduleEveryOnThread accept a zero or negative periodPossibly taken @rajeetvk claimed this today. OpenBug Event System Good First Issue TS API
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
apache/trafficserver#14214 · 1 comment ·
Maintainers usually reply within 2 days
-
HostDBContinuation::init memsets a polymorphic ActionPossibly taken @ANMOLSCRIPT claimed this today. OpenBug Good First Issue HostDB
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
apache/trafficserver#14204 · 1 comment ·
Maintainers usually reply within 2 days
All issues in apache/trafficserver
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 2 days
-
bug data-types
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
ClickHouse/clickhouse-cpp#645 ·
Maintainers usually reply within 1 day
-
bug compatibility difficulty:easy prio:normal
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NatronGitHub/openfx-misc#524 ·
Maintainers usually reply within 1 day
-
documentation enhancement help wanted P0
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Awesome-Embedded-Learning-Studio/Tutorial_AwesomeModernCPP#359 ·
Maintainers usually reply within 1 day
-
Type: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
openscad/openscad#7360 · 2 comments ·
Maintainers usually reply within 1 day