nginx - 502 Gitlab 响应时间过长

标签 nginx gitlab connection-timeout gitlab-omnibus

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

enter image description here

gitlab-ctl restart 之后它又开始工作了。

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

谁能给出永久解决方案。

最佳答案

它很可能会耗尽共享内存。每次备份后都会出现 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 杀死 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 消失了。

关于nginx - 502 Gitlab 响应时间过长,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40467664/

相关文章:

git - 如何确定一个分支是否是 jenkins 文件中的默认分支?

curl - Gitlab API 中的分页最多仅返回 100 per_page

无需提供密码和用户 token 即可进行 GitLab 操作

error-handling - DB2 - CLI0108E 通信链路故障。 SQLSTATE=40003

ssl - 如何使用 Nginx 在 Centos 7 上安装 SSL 证书

站点根页面的 Django 和 Nginx try_files 403

apache - 将.htaccess转换为nginx(mod_rewrite)

nginx - 从 nginx 中的 Set-Cookie header 登录值

java - HttpConnectionParams.setConnectionTimeout 是什么意思?

mysql - 安全地保持 MySQL 连接处于事件状态