Processes leaked by init.d script

I found out that the /etc/init.d/unity-accelerator script leaks processes when you start it repeatedly by accident.

berlin@neptune:~$ ps aux | grep -i unity-accelerator && sudo /etc/init.d/unity-accelerator start
root      2189  8.5  0.6 939572 110276 pts/0   Sl   16:41   0:00 /opt/Unity/accelerator/unity-accelerator run --persist /home/berlin/.config/unity-accelerator
root      2201 11.0  0.7 1390408 115940 pts/0  Sl   16:41   0:00 /opt/Unity/accelerator/unity-accelerator tool wrun --persist /home/berlin/.config/unity-accelerator
berlin    2220  0.0  0.0  21532  1032 pts/0    S+   16:41   0:00 grep --color=auto -i unity-accelerator
berlin@neptune:~$ ps aux | grep -i unity-accelerator && sudo /etc/init.d/unity-accelerator start
root      2189  5.6  0.6 939572 110276 pts/0   Sl   16:41   0:00 /opt/Unity/accelerator/unity-accelerator run --persist /home/berlin/.config/unity-accelerator
root      2201  7.3  0.7 1390408 115940 pts/0  Sl   16:41   0:00 /opt/Unity/accelerator/unity-accelerator tool wrun --persist /home/berlin/.config/unity-accelerator
root      2225 16.0  0.6 939316 103516 pts/0   Sl   16:41   0:00 /opt/Unity/accelerator/unity-accelerator run --persist /home/berlin/.config/unity-accelerator
root      2237 18.0  0.6 1013304 101888 pts/0  Sl   16:41   0:00 /opt/Unity/accelerator/unity-accelerator tool wrun --persist /home/berlin/.config/unity-accelerator
berlin    2251  0.0  0.0  21532  1088 pts/0    S+   16:41   0:00 grep --color=auto -i unity-accelerator
berlin@neptune:~$ ps aux | grep -i unity-accelerator && sudo /etc/init.d/unity-accelerator start
root      2189  5.6  0.6 939572 110276 pts/0   Sl   16:41   0:00 /opt/Unity/accelerator/unity-accelerator run --persist /home/berlin/.config/unity-accelerator
root      2201  7.3  0.7 1390408 115940 pts/0  Sl   16:41   0:00 /opt/Unity/accelerator/unity-accelerator tool wrun --persist /home/berlin/.config/unity-accelerator
root      2225 16.0  0.6 939316 103516 pts/0   Sl   16:41   0:00 /opt/Unity/accelerator/unity-accelerator run --persist /home/berlin/.config/unity-accelerator
root      2237 18.0  0.6 1013304 101888 pts/0  Sl   16:41   0:00 /opt/Unity/accelerator/unity-accelerator tool wrun --persist /home/berlin/.config/unity-accelerator
root      2256  0.0  0.6 1013560 111256 pts/0  Sl   16:41   0:00 /opt/Unity/accelerator/unity-accelerator run --persist /home/berlin/.config/unity-accelerator
root      2269  0.0  0.6 939828 109888 pts/0   Sl   16:41   0:00 /opt/Unity/accelerator/unity-accelerator tool wrun --persist /home/berlin/.config/unity-accelerator
berlin    2282  0.0  0.0  21532  1036 pts/0    S+   16:41   0:00 grep --color=auto -i unity-accelerator
berlin@neptune:~$ ps aux | grep -i unity-accelerator && sudo /etc/init.d/unity-accelerator start
root      2189  4.2  0.6 939572 110276 pts/0   Sl   16:41   0:00 /opt/Unity/accelerator/unity-accelerator run --persist /home/berlin/.config/unity-accelerator
root      2201  5.5  0.7 1390408 115940 pts/0  Sl   16:41   0:00 /opt/Unity/accelerator/unity-accelerator tool wrun --persist /home/berlin/.config/unity-accelerator
root      2225  8.0  0.6 939316 103516 pts/0   Sl   16:41   0:00 /opt/Unity/accelerator/unity-accelerator run --persist /home/berlin/.config/unity-accelerator
root      2237  9.0  0.6 1013304 101888 pts/0  Sl   16:41   0:00 /opt/Unity/accelerator/unity-accelerator tool wrun --persist /home/berlin/.config/unity-accelerator
root      2256 17.0  0.6 1013560 111256 pts/0  Sl   16:41   0:00 /opt/Unity/accelerator/unity-accelerator run --persist /home/berlin/.config/unity-accelerator
root      2269 17.0  0.6 939828 109888 pts/0   Sl   16:41   0:00 /opt/Unity/accelerator/unity-accelerator tool wrun --persist /home/berlin/.config/unity-accelerator
root      2287 16.0  0.6 939316 109104 pts/0   Sl   16:41   0:00 /opt/Unity/accelerator/unity-accelerator run --persist /home/berlin/.config/unity-accelerator
root      2299 17.0  0.6 1013304 109988 pts/0  Sl   16:41   0:00 /opt/Unity/accelerator/unity-accelerator tool wrun --persist /home/berlin/.config/unity-accelerator
berlin    2313  0.0  0.0  21532  1028 pts/0    S+   16:41   0:00 grep --color=auto -i unity-accelerator

The “restart” reature is also not robust, probably if the process doesn’t near-immediately terminate, it will open another process, which then fails to bind to the appropriate ip and port. You then end up with 3 processes, one of these is as “half” unity-accelerator that interferes with the others.

And as a feedback, I don’t think the process should run as root. (that can be circumvented by not installing it as root, but since it has distinct differences in behaviour when doing so, I think this is an intended mode of installation - it should probably create or ask an user/group though)

Yep, that’s a bug and we’ve opened a ticket to fix it internally as [COL-1355]. We are planning on allowing the installation to run as a non-root user as well (this is only required on Linux systems) which can be tracked as [COL-964]. If you watch our release notes thread for these, they’ll eventually show up as fixed.

1 Like