502 Gitlab花了太多时间来回应

时间:2016-11-07 14:31:28

标签: nginx gitlab connection-timeout gitlab-omnibus

每天服用gitlab备份后,gitlab会抛出502错误。 我看到了nginx日志,但没有找到那么多信息。

enter image description here

gitlab-ctl restart之后它再次开始工作。

系统配置: 操作系统:Ubuntu 16.04 LTS 4 GB Ram 200 GB磁盘空间

任何人都可以永久解决它。

2 个答案:

答案 0 :(得分:0)

经过长时间的搜索,我得到了一些关于它的东西。在进行备份后,我的isset变得理想,<?php session_start(); if (isset($_SESSION['MM_Username'])) { header ("Location: home.php"); } ?> 拒绝连接。作为临时解决方案,我已经安装了一个新的cron作业,用于在gitlab备份cronjob的complpetion之后重启gitlab服务。

答案 1 :(得分:0)

很有可能耗尽共享内存。每次备份后,您都会收到502错误。

要使用gitlab-ctl tail tail detail

进行检查

它将显示如下内容:

2019-04-12_12:37:17.27154 FATAL:  could not map anonymous shared memory: Cannot allocate memory
2019-04-12_12:37:17.27157 HINT:  This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 4345470976 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
2019-04-12_12:37:17.27171 LOG:  database system is shut down

然后使用free -m进行检查,这表明没有可用的共享内存。

             total       used       free     shared    buffers     cached
Mem:         16081      13715       2365          0        104        753
-/+ buffers/cache:      12857       3223

然后,您需要检查是否有某个进程占用了太多的共享内存或太多的zomibe进程,然后使用ps -aef | grep ffmpeg | awk '{print $2}' | xargs kill 9 之类的命令将其杀死。

使用free -h进行检查,现在大约有112M个共享内存。

             total       used       free     shared    buffers     cached
Mem:           15G       4.4G        11G       112M        46M       416M
-/+ buffers/cache:       3.9G        11G
Swap:           0B         0B         0B

最后,用gitlab-ctl restart重新启动gitlab,一段时间后gitlab启动,502消失了。