bug-bash
[Top][All Lists]
Advanced

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

Re: Running bash using su -c causes 100% cpu usage on one core


From: Marcus Wichelmannn
Subject: Re: Running bash using su -c causes 100% cpu usage on one core
Date: Mon, 4 Jan 2016 15:01:58 +0100

Am Mo, 4. Jan, 2016 um 2:51 schrieb Eduardo A. Bustamante López <address@hidden>:
It's impossible to tell with the amount of info you provided. That's why there's a 'bashbug' script alongside bash to generate a useful bug report template. Provide: - bash version: bash --version - OS name and version: uname -a - The contents of the run.sh file - If possible also the su version (in my case it doesn't have a version flag, but it's part of the login package). - The output of running said script, with 'set -x' enabled You might not be running bash at all, since you didn't explictly called /bin/bash, instead letting su run /bin/sh, which could be dash, or any other shell.
--
Eduardo Bustamante https://dualbus.me/

Oh, didn't know this script exists, thank you.. ;)
Here are some more information:

Configuration Information [Automatically generated, do not change]:
Machine: arm
OS: linux-gnueabihf
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='arm' -DCONF_OSTYPE='linux-gnueabihf' -DCONF_MACHTYPE='arm-unknown-linux-gnueabihf' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H $
uname output: Linux HAUS-STEUERUNG 3.4.100-sun7i+ #1 SMP PREEMPT Tue Jul 29 13:25:24 CEST 2014 armv7l GNU/Linux
Machine Type: arm-unknown-linux-gnueabihf

Bash Version: 4.3
Patch Level: 30
Release Status: release

/etc/rc.local contains (the issue occurs without the "-s /bin/sh", too):

#!/bin/sh -e

alias ls="ls --color"

echo 0 > /sys/class/leds/green\:ph20\:led1/brightness

su cubie -c "(cd /home/cubie/Haussteuerung/Haussteuerung; ./run.sh)" -s /bin/sh &

exit 0

run.sh contains:

#!/bin/sh

./Haussteuerung >> log 2>&1
bash mailnotify.sh "Unerwarteter Fehler" "Das Haussteuerungsprogramm wurde unerwartet beendet! Siehe Anhang fuer weitere Informationen." log

"Haussteuerung" is a compiled mono executable.

Information about the "login" package:

login:
  Installiert: 1:4.1.5.1-1
  Installationskandidat: 1:4.2-3
  Versionstabelle:
     1:4.2-3 0
        500 http://ftp.de.debian.org/debian/ stable/main armhf Packages
 *** 1:4.1.5.1-1 0
        100 /var/lib/dpkg/status

When executing run.sh with the -x parameter the output is only

+ ./Haussteuerung

And /etc/rc.local prints:

sudo /etc/rc.local
+ alias ls=ls --color
+ echo 0
+ exit 0
+ su cubie -c (cd /home/cubie/Haussteuerung/Haussteuerung; ./run.sh) -s /bin/sh

Output from htop (the first process has a cpu usage of 100%):

PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command
2199 cubie 20 0 44168 15484 7552 R 101. 1.7 11:45.44 /usr/bin/cli ./Haussteuerung
2206 cubie 20 0 44168 15484 7552 S 1.4 1.7 0:05.98 /usr/bin/cli ./Haussteuerung
2081 root 20 0 3884 1324 988 S 0.0 0.1 0:00.03 su cubie -c (cd /home/cubie/Haussteuerung/Haussteuerung; ./run.sh) -s /bin/sh

When running run.sh directly in the terminal the cpu usage is at 2%. The "Haussteuerung" executable works correctly in both cases.

I hope this information helps.

Marcus

reply via email to

[Prev in Thread] Current Thread [Next in Thread]