REPRODUCIBILITY: 100%
OS VERSION: 4.5.0.19
HARDWARE: 10 III
UI LANGUAGE: Polish, English
REGRESSION: YES
DESCRIPTION:
If you execute a command in the Terminal that uses more
for its output (which doesn’t automatically end and return to shell) and you just close the Terminal window without first terminating the running command (e.g. using Ctrl-C) so that it ends and returns to shell, the more
process keeps running invisibly in the background, uses 100% of one CPU core and eats a lot of battery.
(Similar thing applies to also other commands which don’t automatically return to shell, e.g. top, whose processes also stay running in the background, it’s just that their CPU usage is lower, see the “Additional information” section below).
A good example of a command using “more” for output is systemctl
. So to reproduce this issue, just type e.g.
systemctl status mce
(which will display the status of the mce service and then wait at the (END) prompt without automatically exiting and returning to shell) and close the Terminal window. Now use some tool to check running processes (be it top or htop in Terminal, or some GUI tool like Crest) and notice how the more
process keeps running in the background, using literally 100% of one CPU core and eating your battery like crazy, as can be seen on the following screenshots.
Htop
output showing 100% usage of CPU 6 by the more
process:
Top
output showing 12.4% of CPU usage by more
process (it shows usage of all cores, so it equals 100% usage of one of the eight cores as 12.4% ~ 100/8
Crest output:
PRECONDITIONS:
None
STEPS TO REPRODUCE:
- Open Terminal
- Execute a command using ‘more’ to display its output, e.g.:
systemctl status mce
- Close the Terminal
- Use top, Crest, or whatever to see running processes, notice 100% usage of one core by ‘more’ process still running in the background, also notice battery level very quickly decreasing
EXPECTED RESULT:
Closing the Terminal should terminate the execution of more, as it is much too easy to forget to manually terminate it. If it stays running invisibly in the background, it uses 100% of one CPU core and eats battery like crazy.
ACTUAL RESULT:
After closing the Terminal, if not manually interrupted e.g. by Ctrl-C, the more
process keeps running in the backround, uses 100% of one CPU core and crazy amounts of energy.
MODIFICATIONS:
None related.
ADDITIONAL INFORMATION:
This is 100% reproducible, i.e. it happens each single time if the output of ‘more’ is not manually terminated using e.g. Ctrl-C prior to closing the Terminal window. Be it a bug or not, something should be done about it because it is way too easy to leave the more
process invisibly running in the backgroud this way, and it has really bad consequences as it eats battery like crazy.
Even worse, it is actually NOT limited to just more
, but to many other commands, which also stay running in the background after closing the Terminal, of which a good example is e.g. top
. It’s just that (so far) I haven’t seen such an enormous CPU usage by those other processes (e.g. top
when left running uses only 0.5 - 1%) but they are also there and also unnecessarily eat power, take CPU time and memory.