Artifacts Associated With Ticket f1a25e8a50
Ticket change [3334849368] (rid 261679) by serhiy.storchaka on 2026-11-14 16:49:44:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-markdown"
- comment initialized to:
``` close stdin set t [testthread create {testthread wait}] ``` run in tcltest panics with ``` Tcl_InitNotifier: could not create trigger eventfd ``` Every new thread fails the same way. For example, `thread::create` or `tpool::post` from the Thread package after `close stdin`. With stdin closed, fd 0 is free, so `eventfd()` in the new thread's `PlatformEventsInit()` gets fd 0. `unix/tclEpollNotfy.c` treats that as an error (`if (tsdPtr->triggerEventFd <= 0)`) instead of checking for `< 0`. `TclpFinalizeNotifier()` makes the same assumption: it only closes the eventfd, trigger pipe and epoll/kqueue fds if they are non-zero, so a notifier fd that is 0 is never closed. `unix/tclKqueueNotfy.c` has the same check in finalize. Affects 9.0 and 9.1 on Linux, where epoll is the default notifier. 8.6 is not affected. - foundin initialized to: "9.0.5, 9.1.0"
- is_private initialized to: "0"
- login: "serhiy.storchaka"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Important"
- status initialized to: "Open"
- submitter initialized to: "serhiy.storchaka"
- subsystem initialized to: "01. Notifier"
- title initialized to:
New thread panics "Tcl_InitNotifier: could not create trigger eventfd" when stdin is closed
- type initialized to: "Bug"
Ticket change [df3a0b5a61] (rid 261685) by serhiy.storchaka on 2026-11-14 17:51:58:
- icomment:
Proposed fix in branch [/timeline?r=notifier-fd-zero|notifier-fd-zero]: the epoll notifier now accepts an eventfd of 0. The epoll and kqueue notifiers now also close their trigger and epoll/kqueue descriptors when one is 0; until now the kqueue notifier leaked fd 0. Test thread-9.2. Tested on Linux (epoll) and FreeBSD (kqueue).
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [5f03592f0b] (rid 261790) by jan.nijtmans on 2026-11-17 11:27:12:
- assignee changed to: "jan.nijtmans"
- comment changed to:
``` close stdin set t [testthread create {testthread wait}] ``` run in tcltest panics with ``` Tcl_InitNotifier: could not create trigger eventfd ``` Every new thread fails the same way. For example, `thread::create` or `tpool::post` from the Thread package after `close stdin`. With stdin closed, fd 0 is free, so `eventfd()` in the new thread's `PlatformEventsInit()` gets fd 0. `unix/tclEpollNotfy.c` treats that as an error (`if (tsdPtr->triggerEventFd <= 0)`) instead of checking for `< 0`. `TclpFinalizeNotifier()` makes the same assumption: it only closes the eventfd, trigger pipe and epoll/kqueue fds if they are non-zero, so a notifier fd that is 0 is never closed. `unix/tclKqueueNotfy.c` has the same check in finalize. Affects 9.0 and 9.1 on Linux, where epoll is the default notifier. 8.6 is not affected. - icomment:
Fixed in [64ce9de2a3|trunk] OK for backport to 9.0 (not done yet)
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Pending"
Ticket change [9b110b6bc0] (rid 261982) by jan.nijtmans on 2026-11-20 16:45:14:
- closedate changed to: "2461365.1980810994"
- closer changed to: "jan.nijtmans"
- icomment:
Now also merged to core-9-0-branch Many thanks!
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- status changed to: "Closed"