Bug #757

Lock-up when calling select(2) or poll(2) from "child" LWP [status=resolved,priority=bug]

Added by nthery about 7 years ago. Updated about 7 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

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

History

#1 Updated by corecode about 7 years ago

wow, good catch!

thanks, committed!
simon

#2 Updated by pavalos about 7 years ago

Committed and MFC'd.

Also available in: Atom PDF