~mil/sxmo-tickets#464: 
fork bomb. sxmo_audio.sh and /usr/share/sxmo/default_hooks/statusbar update recursive calls ?

Working on sxmo_alarm.sh, I noticed, since I upgraded to 1.8.0, that when I set the volume from a cron task (busybox's crond) the, my system hangs, creating thousands of processes. I could see in htop this process tree (sorry, it's an image, that's all I could get while the phone freezes): https://i.imgur.com/SbdSct8.png

To reproduce, add this in your crontab and wait for the task to run (BEWARE: a hard reboot is the only way out):

58 16 * * * /usr/bin/sxmo_audio.sh vol get > /tmp/cronvol

Note that in my screenshot, we don't see the original process, I killed it, but the fork bomb was re-parented to init.

Status
RESOLVED FIXED
Submitter
~lisael
Assigned to
No-one
Submitted
3 years ago
Updated
3 years ago
Labels
No labels applied.

~lisael 3 years ago

I thought this would split a ton of logs, but it didn't:

10 18 * * * sh -c "set -x; /usr/bin/sxmo_audio.sh vol get 2>&1 | tee /home/user/forklog"

I got only one line:

/usr/bin/sxmo_audio.sh: line 142: can't create /sxmo.audiocurrentdevice: Permission denied

XDG_RUNTIME_DIR is missing (maybe we should set -u wherever possible)?

EDIT, sourcing /etc/profile.d/sxmo_init.sh seems to fix the issue altogether

18 18 * * * sh -c "set -x; . /etc/profile.d/sxmo_init.sh && /usr/bin/sxmo_audio.sh vol get 2>&1 | tee /home/user/forklog"
$ cat forklog
74

We should require that sxmo_init.sh is sourced at a bunch of strategic points.

~stacyharper 3 years ago

You shouldnt set or get the volume from cron jobs anyway. Things that need a dbus session as pipewire or pulseaudio would fail without it.

You should probably load sxmo_init.sh before running the sxmo_audio.sh in your cronjob line.

~baroque0 3 years ago

(sorry if unrelated to the initial topic of the thread)

if XDG_RUNTIME_DIR is missing via ssh, after a recent upgrade, try to apk del elogind...

~phartman REPORTED FIXED 3 years ago

Register here or Log in to comment, or comment via email.