Project

General

Profile

Actions

Bug #757

closed

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

Added by nthery over 16 years ago. Updated over 16 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

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

Actions #1

Updated by corecode over 16 years ago

wow, good catch!

thanks, committed!
simon

Actions #2

Updated by pavalos over 16 years ago

Committed and MFC'd.

Actions

Also available in: Atom PDF