Ubuntu – Is this behaviour of VLC normal

16.04processunityvlc

I'm on ubuntu 16.04 unity latest updates installed, I have one of the best Asus gaming laptops in the market, VLC is installed but I never use it.

For the last few months, I wasn't able to shut down my PC, every time I try to do so, the fans start spinning so fast and it hangs, so I just press the shut down button, that problem was only on shutdown, not restart I didn't even bother trying to solve the problem.

Today, while I was working, I noticed the fans doing the same thing that they normally do while shutting down. I ran top noticed 2 vlc instances being run under my username consuming like 122% cpu each, although again I don't use vlc, and I'm not using any program that relies on vlc.

I tried to sudo kill <pid> and sudo killall <pid> and sudo killall vlc but still they weren't killed, that never happened to me before. I killed them from Ubuntu resource monitor, they were killed and the shutdown problem was fixed, and everything went back to normal.

Did that happen to anybody before?

Best Answer

I'm experiencing similar problem with VLC player. But the difference is I'm using it often. Here is one possible (not fully proofed) workaround for this issue on Ubuntu 16.04 with Unity.

According to this answer we can test whether there is a running application desktop file named vlc or so. If there is no one we can try to kill all VLC's processes. For this purposes create an executable file, named ~/bin/vlc-killer.sh, and add the following lines as its content (here is a reference about the exported envvars):

#!/bin/bash

# Check whether the user is logged-in: if not then exit
if [[ -z "$(pgrep gnome-session -n -U $UID)" ]]; then exit; fi

# Export the current desktop session environment variables
export $(xargs -0 -a "/proc/$(pgrep gnome-session -n -U $UID)/environ")

# Test whether there is any VLC RunningApplicationsDesktopFile
/usr/bin/qdbus org.ayatana.bamf /org/ayatana/bamf/matcher \
org.ayatana.bamf.matcher.RunningApplicationsDesktopFiles | grep -q 'vlc'

# If not killall VLC processes
if [[ $? -ne 0 ]]; then /usr/bin/killall vlc; fi

Then open the user's Crontab for edit (crontab -e) and apply the following job (that will execute our script each minute) at the bottom:

* * * * * $HOME/bin/vlc-killer.sh >/dev/null 2>&1