Monday, March 27, 2017

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 after 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/
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= 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

No comments: