Lock-up when calling select(2) or poll(2) from "child" LWP

Nicolas Thery nthery at gmail.com
Thu Aug 2 06:13:30 PDT 2007


Hello,

When select(2) or poll(2) puts to sleep a LWP, the LWP may never be woken up
when the events waited for occur because the TID of the LWP is not saved in
the selinfo structure by selrecord().

si_tid is not initialised explicitly anywhere but happens to bet set to 0 (for
pipes at least, I haven't checked other occurences), so the problem is not
reproducible for the initial LWP created at process construction time.

The following patch fixes the problem.

Cheers,
Nicolas

Index: src/sys/kern/sys_generic.c
===================================================================
--- src.orig/sys/kern/sys_generic.c	2007-08-01 22:14:28.000000000 +0200
+++ src/sys/kern/sys_generic.c	2007-08-02 13:56:28.000000000 +0200
@@ -1093,6 +1093,7 @@
 		sip->si_flags |= SI_COLL;
 	} else {
 		sip->si_pid = selector->td_proc->p_pid;
+		sip->si_tid = selector->td_lwp->lwp_tid;
 	}
 }





More information about the Submit mailing list