DragonFly submit List (threaded) for 2007-08
DragonFly BSD
DragonFly submit List (threaded) for 2007-08
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

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


From: "Nicolas Thery" <nthery@xxxxxxxxx>
Date: Thu, 2 Aug 2007 15:12:06 +0200

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;
 	}
 }



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]