[Bug 880049] [NEW] 100% CPU usage in init if /dev/console is not available
Cedric Schieli
cschieli at gmail.com
Sat Oct 22 18:47:40 UTC 2011
Public bug reported:
When /dev/console is not available (for example when running as an OpenVZ guest), init consumes 100% time of one CPU core.
Here is a strace excerpt captured on the OpenVZ host :
...
waitid(P_ALL, 0, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
clock_gettime(CLOCK_MONOTONIC, {3903451, 826182267}) = 0
select(5, [0 3 4], [], [4], NULL) = 1 (in [0])
read(0, "", 1) = 0
waitid(P_ALL, 0, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
clock_gettime(CLOCK_MONOTONIC, {3903451, 826467596}) = 0
select(5, [0 3 4], [], [4], NULL) = 1 (in [0])
read(0, "", 1) = 0
waitid(P_ALL, 0, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
clock_gettime(CLOCK_MONOTONIC, {3903451, 827157279}) = 0
select(5, [0 3 4], [], [4], NULL) = 1 (in [0])
read(0, "", 1) = 0
...
Here is what happens :
- in init's main function, system_setup_console(CONSOLE_OUTPUT) fails, leaving file descriptors 0 and 1 uninitialized
- nih_main_loop_init eventually get called, initializing its interrupt_pipe on file descriptors 0 and 1
- we end up calling system_setup_console(CONSOLE_NONE), resetting file descriptors 0 and 1 to /dev/null
- in nih_main_loop, select is called on 0 (/dev/null instead of the pipe) which repeatedly appears to have changed
I'm attaching a small patch which fixes this.
** Affects: upstart (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to upstart in Ubuntu.
https://bugs.launchpad.net/bugs/880049
Title:
100% CPU usage in init if /dev/console is not available
Status in “upstart” package in Ubuntu:
New
Bug description:
When /dev/console is not available (for example when running as an OpenVZ guest), init consumes 100% time of one CPU core.
Here is a strace excerpt captured on the OpenVZ host :
...
waitid(P_ALL, 0, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
clock_gettime(CLOCK_MONOTONIC, {3903451, 826182267}) = 0
select(5, [0 3 4], [], [4], NULL) = 1 (in [0])
read(0, "", 1) = 0
waitid(P_ALL, 0, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
clock_gettime(CLOCK_MONOTONIC, {3903451, 826467596}) = 0
select(5, [0 3 4], [], [4], NULL) = 1 (in [0])
read(0, "", 1) = 0
waitid(P_ALL, 0, {}, WNOHANG|WEXITED|WSTOPPED|WCONTINUED, NULL) = 0
clock_gettime(CLOCK_MONOTONIC, {3903451, 827157279}) = 0
select(5, [0 3 4], [], [4], NULL) = 1 (in [0])
read(0, "", 1) = 0
...
Here is what happens :
- in init's main function, system_setup_console(CONSOLE_OUTPUT) fails, leaving file descriptors 0 and 1 uninitialized
- nih_main_loop_init eventually get called, initializing its interrupt_pipe on file descriptors 0 and 1
- we end up calling system_setup_console(CONSOLE_NONE), resetting file descriptors 0 and 1 to /dev/null
- in nih_main_loop, select is called on 0 (/dev/null instead of the pipe) which repeatedly appears to have changed
I'm attaching a small patch which fixes this.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/880049/+subscriptions
More information about the foundations-bugs
mailing list