I installed Gitlab on Raspberry Pi2, and it had worked well for a couple of months. But since shutting down the power of RPi, it doesn’t work anymore. The webpage returns 502 error.
502 Whoops, GitLab is taking too much time to respond.
So I tried reconfigure (sudo gitlab-ctl reconfigure
) but, it failed with the error message:
FATAL: Errono::EAFNOSUPPORT: Address family not supported by protocol - socket(2)
I don’t know how to resolve this problem.
edwardmlyte
15.7k23 gold badges58 silver badges82 bronze badges
asked Oct 21, 2015 at 8:11
2
I saw issue like this several times.
If GitLab has been worked fine please do not touch anything. Just wait. It seems GitLab has not been started properly
I mean that after booting system you have to wait 1-2 minutes before using GitLab. GitLab needs some time for starting.
answered Oct 12, 2016 at 7:06
VladVlad
3,4651 gold badge30 silver badges24 bronze badges
3
I am not adding a comment since my answer needs some good formatting.
So that means, your port 8080 is already being used. I would advise to stop GitLab, and change unicorn port from 8080 to 8081 (or some unused port).
After starting/restarting GitLab wait for 2 minutes, and you should be okay. If not, again check gitlab-ctl tail
for any errors.
# gitlab-ctl stop
# vi /etc/gitlab/gitlab.rb (change only these lines, uncomment if required)
unicorn['port'] = 8081
gitlab_git_http_server['auth_backend'] = "http://localhost:8081"
# gitlab-ctl reconfigure (to apply the changes)
# gitlab-ctl restart
# lsof -i:8081 (check whether unicorn has started properly)
You need to be root or a sudo user (with root privileges) to run these commands.
answered Nov 29, 2015 at 10:38
vikas027vikas027
5,1724 gold badges39 silver badges51 bronze badges
7
After inspecting the gitlab-ctl tail (reboot loop) it turned out that there is not enough RAM (2GB) and there is no swap file in my fresh Ubuntu setup.
As mentioned in requirements GitLab requires at least 2GB RAM + 2GB swap memory …
So to create a swap file follow those steps:
-
gitlab-ctl stop
-
mkdir /swap && touch /swap/swapfile.img
dd if=/dev/zero of=/swap/swapfile.img bs=1024 count=2M
# if you want 4G change 2M to 4Mchmod 0600 /swap/swapfile.img
mkswap /swap/swapfile.img
nano /etc/fstab
and add «/swap/swapfile.img swap swap sw 0 0»swapon /swap/swapfile.img
-
Verify if it works :
cat /proc/swaps
Filename Type Size Used Priority /swap/swapfile.img file 2097148 0 -1
-
gitlab-ctl start
more info about creating swap : here
answered Feb 28, 2018 at 10:58
trojantrojan
1,45519 silver badges27 bronze badges
1
You can follow below steps to fix this kind of issue.
- Update
unicorn['port']
to****
.(Different port which is not used for process in the system) - Update
nginx['port']
to****
.(Different port which is not used for process in the system) - Update
web_server
username andweb_server
group in this file as well and set it to apache’s/httpd’s username and group
Then do gitlab-ctl reconfigure
and gitlab-ctl restart
Cà phê đen
1,8652 gold badges21 silver badges20 bronze badges
answered Oct 12, 2016 at 7:16
himeshc_IBhimeshc_IB
8434 silver badges10 bronze badges
You should change your Unicorn Settings
If you need to adjust the Unicorn timeout or the number of workers you can use the following settings in /etc/gitlab/gitlab.rb
.
Change the following:
unicorn['worker_processes'] = 3
unicorn['worker_timeout'] = 120 # or any suitable timeout for your server
do not forget to remove # in line start if commented.
Run sudo gitlab-ctl reconfigure
for the change to take effect.
answered Jul 29, 2018 at 10:04
Anas NaguibAnas Naguib
99610 silver badges12 bronze badges
This error is also occurred when the system, in your case the Raspberry Pi2 (in my case, in an t2.micro AWS EC2 instance) due to not fulfilling the minimum requirements for installing Gitlab.
That is the lack of Memory (t2.micro is 1GiB, but Gitlab requires 4GiB) for further processing. Therefore, provide all the requirements correctly (I occupied a t2.medium instance which is 4GiB instead of t2.micro).
It would be appropriate if the system has been enabled accurately.
answered Nov 9, 2017 at 5:00
Need to set nginx[‘listen_port’] and unicorn[‘port’].
For example:
nginx['listen_port'] = 8081
unicorn['port'] = 8082 #the ports should be different
Then:
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
answered Dec 4, 2017 at 12:22
1
There was a port collision at my site. Jenkins has already run on my site, which uses the 8080 port also.
Change Gitlab or Jenkins port.
answered Mar 19, 2020 at 10:55
betontalpfabetontalpfa
3,3841 gold badge32 silver badges65 bronze badges
Something is listening to the 8080 port, so Unicorn can’t start.
What does the following command indicate?
The ports for Redis, PostgreSQL and Puma can be overridden in
/etc/gitlab/gitlab.rb
as follows:
redis['port'] = 1234
postgresql['port'] = 2345
puma['port'] = 3456
For NGINX port changes please see settings/nginx.md.
see https://docs.gitlab.com/omnibus/common_installation_problems/#tcp-ports-for-gitlab-services-are-already-taken
(TCP ports for GitLab services are already taken)
answered May 16, 2020 at 9:23
ismaelismael
4341 gold badge4 silver badges11 bronze badges
Please note if you got 502 Whoops, GitLab is taking too much time to respond
before going so much with every step
- Ensure that your server has at least 4GB of RAM
- and give her server at least 10 minutes if you are using digital ocean droplet
answered Nov 22, 2021 at 12:44
I had that kind of error before and turns out that I had not physicall space (in my case, a virtual machine). Check that you have enough space
answered Apr 30, 2022 at 13:45
JoseJose
175 bronze badges
It is posyble that you has change change some configuration file, use this lines in your terminal:
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
Now wait a few minutes, and try again.
answered Jul 13, 2018 at 16:34
You should only change external_url http://xxx.xxx.xxx.xx:9090
. Don’t change # unicorn['port'] = 8080
.
Cà phê đen
1,8652 gold badges21 silver badges20 bronze badges
answered Jun 17, 2019 at 2:45
1
Теги: nginx, gitlab, гитлаб
Нередко пользователи сервиса GitLab сталкиваются с проблемой под названием «Ошибка 502». Как правило, она сопровождается следующей фразой: «Whoops, GitLab is taking too much time to respond». Давайте разберём, в чём может быть проблема.
Ошибку 502, как и вышеупомянутую фразу, вам показывает Nginx (компонент, входящий в GitLab). В общем случае речь идёт о том, что web-сервер не может получить от бэкенда ответ. А раз мы говорим о GitLab, то бэкендом здесь выступает Unix-сокет — /var/opt/gitlab/gitlab-workhorse/socket. Тут стоит упомянуть, что конфигурация Nginx для GitLab находится по адресу /var/opt/gitlab, а конкретно Nginx — здесь: /var/opt/gitlab/nginx/conf.
Почему же бэкенд не отвечает?
Ответить на этот вопрос со 100%-ной точностью нельзя. Но ряд причин всё же имеется:
1. У вас на сервере недостаточно оперативной памяти. Если памяти всего 2 Гб, ошибку 502 вы будете всё равно время от времени видеть, даже работая с GitLab в одиночку. Дело в том, что для работы таких компонентов, как Nginx, PostgreSQL, Redis и прочих требуется много памяти. В качестве решения проблемы можно увеличить либо включить swap.
2. У вас упала служба под названием GitLab-workhorse. Она открывает сокет, который слушает Nginx. А вот почему это произошло — вопрос отдельный. Не менее интересно и то, почему она функционирует, а сокета нет. Чтобы решить проблему, попробуйте просто перезагрузить сервер. Также бывает, что сервис падает из-за занятого порта какой-то службы, относящейся к GitLab. Это случается, если на сервере, кроме GitLab запущены другие службы. Ошибки могут быть и в конфигурации. Также нередко проблемы появляются после обновления.
3. Из-за каких-то причин изменились права доступа к сокету /var/opt/gitlab/gitlab-workhorse/socket, в результате чего Nginx не может получить доступ. Проверьте, от какого именно пользователя работает Nginx и удостоверьтесь, что у него достаточно прав для доступа к сокету.
Пожалуй, это основные причины возникновения ошибки 502 в GitLab, покрывающие большинство случаев.
Более подробно ознакомиться с архитектурой GitLab и освоить нюансы его работы вы можете на курсе CI/CD. Именно этой теме посвящено несколько занятий из первого модуля. Скачать программу курса можно здесь.
По материалам статьи «Установка и настройка Gitlab на Centos и Ubuntu».
Loading
Solution by iamchanghyunpark
“I checked the pid value in the log and checked if there was a running process with the same pid, and no there was none.
I’m guessing this is because of the unexpected powerdown, and unicorn.pid was not properly cleared.
My solution was simple”
docker-compose exec gitlab bash
vi log/unicorn.stderr.log # remove the value (which is the pid), save and exit
exit # from the bash shell of the gitlab container
#Now restart the containers
docker-compose down
docker-compose up -d
Share on:
I have set up gitlab on cent OS but have got stuck in a 502 error and not sure where to go, I have upgraded my server as I feared it was Memory but the error is the same after upgrade.
gitlab.rb
external_url 'http://gitlab.adamprocter.co.uk:8081'
web_server['external_users'] = ['www-data']
My server is running its own nginx as well for other service on port 80 etc but I could not get gitlab to even get a 502 with — nginx[‘enable’] = false and my own settings in my custom.conf so I think this should work configure seem ok as does restart
ok: run: gitlab-workhorse: (pid 32665) 1s
ok: run: logrotate: (pid 32673) 0s
ok: run: nginx: (pid 32680) 1s
ok: run: postgresql: (pid 32697) 0s
ok: run: redis: (pid 32705) 0s
ok: run: sidekiq: (pid 32733) 0s
ok: run: unicorn: (pid 32737) 0s
but tail has this error
2016-04-15_20:31:17.45447 2016/04/15 16:31:17 error: proxyRoundTripper: GET "/" failed with: "dial unix /var/opt/gitlab/gitlab-rails/sockets/gitlab.socket: connect: permission denied"
also further in the log
2016-04-15_20:45:27.58466 from /opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/unicorn:23:in `load'
2016-04-15_20:45:27.58469 from /opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/unicorn:23:in `<main>'
2016-04-15_20:45:27.60371 master failed to start, check stderr log for details
2016-04-15_20:45:28.61194 failed to start a new unicorn master
2016-04-15_20:45:28.63357 starting new unicorn master
2016-04-15_20:45:30.23368 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:778:in `initialize': Permission denied @ rb_sysopen - /var/log/gitlab/unicorn/unicorn_stderr.log (Errno::EACCES)
I had tried to edit permissions but I dont know if I did it right… and made no difference
sudo chmod 0660 /var/opt/gitlab/gitlab-rails/sockets/gitlab.socket
sudo chown nginx:gitlab-www /var/opt/gitlab/gitlab-rails/sockets/gitlab.socket