Search Unity

Can't start Unity Accelerator v1.0.196+ge1f9988 on Linux

Discussion in 'Unity Accelerator' started by shiena, Feb 29, 2020.

  1. shiena

    shiena

    Joined:
    May 19, 2017
    Posts:
    44
    The service cannot be started because the conditions for determining the result of the kill command in the start function of the Linux version startup script are incorrect.
    Below is the debug log of the script. Do not start the service even if the pid file does not exist.


    Code (csharp):
    1.  
    2. ~ # /bin/sh -x /opt/Unity/accelerator/unity-accelerator-launch start
    3. + '[' start '=' -fg ]
    4. + FOREGROUND=false
    5. + basename /opt/Unity/accelerator/unity-accelerator-launch .sh
    6. + BN=unity-accelerator-launch
    7. + AGENT=/opt/Unity/accelerator/unity-accelerator
    8. + PRODUCT_SLUG=unity-accelerator
    9. + STORAGEDIR=/root/.config/unity-accelerator
    10. + NPMPATH=
    11. + PIDFN=/root/.config/unity-accelerator/unity-accelerator.pid
    12. + LOGFN=/root/.config/unity-accelerator/unity-accelerator-launch-launch.log
    13. + start
    14. + '[' -n  ]
    15. + cat /root/.config/unity-accelerator/unity-accelerator.pid
    16. + pid=
    17. + kill -0
    18. + echo 'unity-accelerator is running as '
    19. unity-accelerator is running as
    20. + exit 0
    21.  
     
  2. shiena

    shiena

    Joined:
    May 19, 2017
    Posts:
    44
    The service has been started with the following modifications.

    Code (csharp):
    1.  
    2. ~ # diff -u /opt/Unity/accelerator/unity-accelerator-launch.origin /opt/Unity/accelerator/unity-accelerator-launch
    3. --- /opt/Unity/accelerator/unity-accelerator-launch.origin
    4. +++ /opt/Unity/accelerator/unity-accelerator-launch
    5. @@ -22,7 +22,7 @@
    6. export PATH
    7. fi
    8. pid="$(cat "$PIDFN" 2>/dev/null)"
    9. - if ! kill -0 "$pid" 2>/dev/null; then
    10. + if ! kill -0 $pid 2>/dev/null; then
    11. if $FOREGROUND; then
    12. echo "$$" > "$PIDFN"
    13. exec "$AGENT" run --persist "$STORAGEDIR" >"${LOGFN}" 2>&1
    14. @@ -37,7 +37,7 @@
    15.  
    16. status () {
    17. pid="$(cat "$PIDFN" 2>/dev/null)"
    18. - if kill -0 "$pid" 2>/dev/null; then
    19. + if kill -0 $pid 2>/dev/null; then
    20. echo "${PRODUCT_SLUG} is running as $pid"
    21. else
    22. echo "${PRODUCT_SLUG} is not running" >&2
    23.  
     
    Last edited: Feb 29, 2020
  3. bradunity

    bradunity

    Joined:
    Nov 12, 2013
    Posts:
    195
    Thank you @shiena, that is clearly a bug in our recent change to prevent running multiple instances of the Accelerator. We'll get this fixed up.
     
    shiena likes this.
  4. shiena

    shiena

    Joined:
    May 19, 2017
    Posts:
    44
    @bradunity As I noticed later, when using Accelerator with Docker, unity-accelerator-launch set in CMD always has pid 1, so it will be caught in multiple launch inspection. This can be avoided by adding a comparison with your own pid.
    Code (csharp):
    1.  
    2. ~ # diff -u /opt/Unity/accelerator/unity-accelerator-launch.orig /opt/Unity/accelerator/unity-accelerator-launch
    3. --- /opt/Unity/accelerator/unity-accelerator-launch.orig
    4. +++ /opt/Unity/accelerator/unity-accelerator-launch
    5. @@ -22,7 +22,7 @@
    6.          export PATH
    7.      fi
    8.      pid="$(cat "$PIDFN" 2>/dev/null)"
    9. -    if ! kill -0 $pid 2>/dev/null; then
    10. +    if [ "$$" == "$pid" ] || ! kill -0 $pid 2>/dev/null; then
    11.          if $FOREGROUND; then
    12.              echo "$$" > "$PIDFN"
    13.              exec "$AGENT" run --persist "$STORAGEDIR" >"${LOGFN}" 2>&1
    14.  
     
    bradunity likes this.