Tcl Source Code

View Ticket
Login
2026-11-14
12:20 • Ticket [7aa8fd34c4] epoll notifier spins and never reports writable after EPOLLE... artifact: 481b38765a user: serhiy.storchaka
12:20
Fix io-78.1 failing intermittently on Windows (see [7aa8fd34c4]): a non-blocking close with a backgr... check-in: ab172b573d user: serhiy.storchaka tags: core-9-0-branch
12:17
Fix io-78.1 failing intermittently on Windows (see [7aa8fd34c4]): a non-blocking close with a backgr... check-in: 4fb793ca8f user: serhiy.storchaka tags: trunk, main
2026-11-02
22:29 • Ticket [20ca033dee] Tcl 9.0.5 failing tests in valgrind status still Open wi... artifact: f82b6e9cbb user: serhiy.storchaka
2026-10-30
09:40 • Closed ticket [7aa8fd34c4]: epoll notifier spins and never reports writable afte... artifact: d2c4d294fe user: jan.nijtmans
09:40
Fix [7aa8fd34c4]: epoll notifier spins and never reports writable after EPOLLERR check-in: b4d7ea90a2 user: jan.nijtmans tags: core-9-0-branch
09:29
Fix [7aa8fd34c4]: epoll notifier spins and never reports writable after EPOLLERR check-in: 6d788a0eb3 user: jan.nijtmans tags: trunk, main
2026-10-16
21:49 • Closed ticket [653218ffff]: Channels CloseProc() not called on close plus 4 ... artifact: 005ad727f2 user: serhiy.storchaka
21:49 • Ticket [7aa8fd34c4] epoll notifier spins and never reports writable after EPOLLE... artifact: 7ce8553e5e user: serhiy.storchaka
21:49
Fix [7aa8fd34c4]: the epoll notifier reports an error condition as readable and writable, like selec... closed check-in: 94240eb7b7 user: serhiy.storchaka tags: epoll-error-writable
21:46 • New ticket [7aa8fd34c4] epoll notifier spins and never reports writable after EP... artifact: 8c833ee4e9 user: serhiy.storchaka

Ticket UUID: 7aa8fd34c4e8ed00e73e06aef189fae1b092d1c4
Title: epoll notifier spins and never reports writable after EPOLLERR
Type: Bug Created on: 2026-10-16 21:46:10
Submitter: serhiy.storchaka Assigned to: jan.nijtmans
Subsystem: 01. Notifier Severity: Minor
Priority: 5 Medium Last modified: 2026-11-14 12:20:38
Status: Closed Closed by: jan.nijtmans
Resolution: Fixed Closed on: 2026-10-30 09:40:46
Version: 9.0.5, 9.1.0
Description:

On Linux (epoll notifier, 8.7 and later), a writable handler on a pipe whose reader has exited never fires: EPOLLERR is translated only to TCL_EXCEPTION, and the level-triggered event wakes epoll_wait() again at once, so the process spins at 100% CPU. A background flush to such a pipe never ends, and [close] reports no error although the data was lost.

set f [open |[list [info nameofexecutable] exit.tcl] w]   ;# child exits at once
fconfigure $f -blocking 0
puts -nonewline $f [string repeat x 300000]
catch {flush $f}
chan event $f writable {set w writable}
after 3000 {set w timeout}
vwait w   ;# 8.6: writable at once, close gives "broken pipe"; 9.x: timeout, close gives no error

select() reports such a descriptor as writable. The code is from [858569fb04].

User Comments:
serhiy.storchaka added on 2026-10-16 21:49:57:

Proposed fix in branch epoll-error-writable: report EPOLLERR as readable and writable, like select() does. Test io-78.1.


jan.nijtmans added on 2026-10-30 09:40:46:

Fixed in [6d788a0eb3|trunk], and core-9-0-branch

Many thanks!


serhiy.storchaka added on 2026-11-14 12:20:38:

io-78.1 failed intermittently on Windows (about 1 run in 10): a non-blocking close with a background flush still scheduled completes in the background and does not report "broken pipe". The test now switches the channel to blocking before closing it: [4fb793ca8f] on trunk, also cherry-picked to core-9-0-branch.