Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-07-07
15:57 • Ticket [6f8bbbb34b] kqueue notifier hangs on OpenBSD status still Closed wit... artifact: 4a19f74b1f user: jan.nijtmans
2026-07-04
18:26 • Closed ticket [6f8bbbb34b]. artifact: 2957848267 user: sebres
18:20 • Open ticket [6f8bbbb34b]. artifact: 04a4db48fc user: stu
18:18 • Closed ticket [6f8bbbb34b]. artifact: db9fcbf0d8 user: sebres
18:17
fixes [6f8bbbb34bf84bf0] hang in BSD/kqueue: fixed infinite wait for kqueue (0 is smallest timeout, ... check-in: 7fa225eb7c user: sebres tags: trunk, main
17:48 • Ticket [6f8bbbb34b] kqueue notifier hangs on OpenBSD status still Open with ... artifact: 81880a1a7a user: sebres
16:50 • New ticket [6f8bbbb34b]. artifact: 18a8316dfb user: stu

kqueue notifier hangs on OpenBSD

Closed / Fixed6f8bbbb34bf84bf0032c9f647e7e480e4ad03904Created 151 days agoUpdated 148 days ago
Descriptionplain2026-07-04 16:50:39
If the kqueue notifier is configured on OpenBSD, tests will hang.
First test to hang is basic-26.1, if skipped then chan-16.9.

checking for advanced notifier support... kqueue(2) : tests hang
checking for advanced notifier support... none : tests pass, all the way through to the end

UPD: 9.1a1 looks good.
sebreswiki2026-07-04 17:48:49

I could bet that it'd be the change of unix/tclKqueueNotfy.c from [def988e9cd676b5b]:


-    if (timePtr != NULL) {
+	timeout.tv_sec = timePtr->sec;
+	timeout.tv_usec = timePtr->usec;
-    if (time > 0) {
+	timeout.tv_sec = time / 1000000;
+	timeout.tv_usec = time % 1000000;
because if time is negative for some reasons, it'd wait infinitely instead of leave waiting proc immediately.

But oldlaptop tested it and it seems to hang further.

However, I'm still sure it shall be rewritten anyway for backwards compatibility reasons (e. g. some extension may call Tcl_WaitForEvent with some negative value and behavior gets changed completely).

sebreswiki2026-07-04 18:18:33

Fixed in [6f8bbbb34bf84bf0]. Thx stu and oldlaptop!

stuplain2026-07-04 18:20:17
Tests pass with this patch, inspired by unix/tclEpollNotfy.c.

Index: unix/tclKqueueNotfy.c
--- unix/tclKqueueNotfy.c.orig
+++ unix/tclKqueueNotfy.c
@@ -640,7 +640,7 @@ TclpWaitForEvent(
      * for, we return with a negative result rather than blocking forever.
      */
 
-    if (time > 0) {
+    if (time >= 0) {
        timeout.tv_sec = time / 1000000;
        timeout.tv_usec = time % 1000000;
        timeoutPtr = &timeout;
sebres Closed ticket [6f8bbbb34b]. [History diff]2026-07-04 18:26:40
jan.nijtmanswiki2026-07-07 15:57:10

Many thanks for this fix!

Log in (anonymous is fine) to add a comment.