Synology GitLab error 502

How to fix the GitLab 502 error

Occasionally when starting GitLab, I get a 502 error ("Whoops, GitLab is taking too much time to respond").  It appears to happen when my Synology NAS has restarted after a power outage.

Checking the Docker GitLab log, I can seen continual messages about trying to restart the "unicorn" process.  This also causes high CPU usage.
2017-03-27 00:35:08,892 INFO spawned: 'unicorn' with pid 27723
2017-03-27 00:35:09,896 INFO success: unicorn entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-03-27 00:35:14,277 INFO exited: unicorn (exit status 1; not expected)
...

To fix the problem, create a terminal window within the Docker application.  Or login to the GitLab console from the root console of your NAS.
# docker exec -it synology_gitlab bash
Then delete the PID file for unicorn.  This will be a stale PID value that doesn't exist any more.
root@synology_gitlab:/home/git/gitlab# rm /home/git/gitlab/tmp/pids/unicorn.pid
The unicorn process should now start properly, and after a minute or two you should be able to login to GitLab.  If necessary, check the log for any additional diagnostics:
root@synology_gitlab:/home/git/gitlab# tail -f /var/log/gitlab/gitlab/unicorn.stderr.log
I, [2017-03-27T11:18:45.310166 #12729] INFO -- : reaped #<Process::Status: pid 12759 exit 0> worker=2
I, [2017-03-27T11:18:45.310584 #12729] INFO -- : master complete
I, [2017-03-27T11:18:58.143931 #12771] INFO -- : Refreshing Gem list
I, [2017-03-27T11:24:51.374610 #436] INFO -- : Refreshing Gem list
I, [2017-03-27T11:27:03.707925 #436] INFO -- : listening on addr=/home/git/gitlab/tmp/sockets/gitlab.socket fd=14
I, [2017-03-27T11:27:03.710037 #436] INFO -- : listening on addr=127.0.0.1:8080 fd=15
I, [2017-03-27T11:27:03.741193 #486] INFO -- : worker=0 ready
I, [2017-03-27T11:27:03.772663 #489] INFO -- : worker=1 ready
I, [2017-03-27T11:27:03.795237 #436] INFO -- : master process ready
I, [2017-03-27T11:27:03.801966 #492] INFO -- : worker=2 ready
If the process is still not running, restart the GitLab package.

TIP: Check out my instructions for Backup and Restore for GitLab.

Comments

清影 said…
I face the issue just now and try many way to fix the issue, but it still happen.
Thanks for the post. I follow the instructions and then gitlab back to normal now.
You save my code/data in the gitlab. Thank you.
Unknown said…
Thank you. Saved we a bunch of time. Thumbs up.

Popular posts from this blog

Resolving FOSCAM connection dropouts

Building an automatic chicken door opener

TVersity media serving to the Astone AP-300