Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 5f03592f0bf6563952125584094f4099ffcc36cc7d5e96a1583e8694ba13adf8
Ticket: f1a25e8a5090333da9c02de51f04f2914fea7bfa
New thread panics "Tcl_InitNotifier: could not create trigger eventfd" when stdin is closed
User & Date: jan.nijtmans on 2026-11-17 11:27:12
Changes

  1. assignee changed to: "jan.nijtmans"
  2. 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.
    
  3. icomment:
    Fixed in [64ce9de2a3|trunk]
    
    OK for backport to 9.0 (not done yet)
    
  4. login: "jan.nijtmans"
  5. mimetype: "text/x-fossil-wiki"
  6. resolution changed to: "Fixed"
  7. status changed to: "Pending"