Search Unity

Bug Processes leaked by init.d script

Discussion in 'Unity Accelerator' started by Moritz5thPlanet, Feb 13, 2020.

  1. Moritz5thPlanet

    Moritz5thPlanet

    Joined:
    Feb 5, 2019
    Posts:
    73
    I found out that the /etc/init.d/unity-accelerator script leaks processes when you start it repeatedly by accident.

    Code (csharp):
    1. berlin@neptune:~$ ps aux | grep -i unity-accelerator && sudo /etc/init.d/unity-accelerator start
    2. 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
    3. 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
    4. berlin    2220  0.0  0.0  21532  1032 pts/0    S+   16:41   0:00 grep --color=auto -i unity-accelerator
    5. berlin@neptune:~$ ps aux | grep -i unity-accelerator && sudo /etc/init.d/unity-accelerator start
    6. 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
    7. 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
    8. 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
    9. 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
    10. berlin    2251  0.0  0.0  21532  1088 pts/0    S+   16:41   0:00 grep --color=auto -i unity-accelerator
    11. berlin@neptune:~$ ps aux | grep -i unity-accelerator && sudo /etc/init.d/unity-accelerator start
    12. 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
    13. 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
    14. 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
    15. 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
    16. 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
    17. 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
    18. berlin    2282  0.0  0.0  21532  1036 pts/0    S+   16:41   0:00 grep --color=auto -i unity-accelerator
    19. berlin@neptune:~$ ps aux | grep -i unity-accelerator && sudo /etc/init.d/unity-accelerator start
    20. 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
    21. 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
    22. 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
    23. 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
    24. 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
    25. 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
    26. 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
    27. 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
    28. berlin    2313  0.0  0.0  21532  1028 pts/0    S+   16:41   0:00 grep --color=auto -i unity-accelerator
    29.  
    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)
     
  2. bradunity

    bradunity

    Joined:
    Nov 12, 2013
    Posts:
    195
    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.
     
    Moritz5thPlanet likes this.