gitlab 无法查看提交的文件Errno::ENOMEM (Cannot allocate memory - /opt/gitlab/embedded/bin/git):
gitlab可以成功clone和push,但是提交后的文件却无法查看。从页面上看的话只显示出500错误。
查了下gitlab的日志
tail -f /var/log/gitlab/gitlab-rails/production.log
显示如下异常:
Started GET "/gitlab/root/test/commit/e83228ea1bbf183a0f3199f11f995731b23bc1f7" for 14.23.93.99 at 2016-07-04 17:49:08 +0800 Processing by Projects::CommitController#show as HTML Parameters: {"namespace_id"=>"root", "project_id"=>"test", "id"=>"e83228ea1bbf183a0f3199f11f995731b23bc1f7"} Completed 200 OK in 224ms (Views: 156.4ms | ActiveRecord: 14.7ms) Started GET "/gitlab/root/test/commit/e83228ea1bbf183a0f3199f11f995731b23bc1f7/branches" for 14.23.93.99 at 2016-07-04 17:49:09 +0800 Processing by Projects::CommitController#branches as HTML Parameters: {"namespace_id"=>"root", "project_id"=>"test", "id"=>"e83228ea1bbf183a0f3199f11f995731b23bc1f7"} Completed 500 Internal Server Error in 291ms (ActiveRecord: 3.1ms) Errno::ENOMEM (Cannot allocate memory - /opt/gitlab/embedded/bin/git): lib/gitlab/popen.rb:23:in `popen' app/models/repository.rb:648:in `refs_contains_sha' app/models/repository.rb:664:in `branch_names_contains' app/controllers/projects/commit_controller.rb:64:in `branches' lib/gitlab/middleware/go.rb:16:in `call' Started GET "/gitlab/root/test/autocomplete_sources?type=Commit&type_id=e83228ea1bbf183a0f3199f11f995731b23bc1f7" for 14.23.93.99 at 2016-07-04 17:49:10 +0800 Processing by ProjectsController#autocomplete_sources as JSON Parameters: {"type"=>"Commit", "type_id"=>"e83228ea1bbf183a0f3199f11f995731b23bc1f7", "namespace_id"=>"root", "id"=>"test"} Completed 200 OK in 170ms (Views: 83.8ms | ActiveRecord: 9.9ms) Started GET "/gitlab/root/test/notes?target_id=e83228ea1bbf183a0f3199f11f995731b23bc1f7&target_type=commit&last_fetched_at=1467625748" for 14.23.93.99 at 2016-07-04 17:49:24 +0800 Processing by Projects::NotesController#index as JSON Parameters: {"target_id"=>"e83228ea1bbf183a0f3199f11f995731b23bc1f7", "target_type"=>"commit", "last_fetched_at"=>"1467625748", "namespace_id"=>"root", "project_id"=>"test"} Completed 200 OK in 47ms (Views: 0.3ms | ActiveRecord: 3.6ms)
查了下内存为2G,已经满足gitlab最小内存1G的要求。
[root@xxxxxx ~]# free -h total used free shared buffers cached Mem: 1.8G 1.7G 63M 43M 9.7M 140M -/+ buffers/cache: 1.6G 213M Swap: 0B 0B 0B
但是非常诡异的是swap为0,网上找了发现也有人遇到相应的问题。于是修改下swap的大小
[root@xxxx ~]# free -h total used free shared buffers cached Mem: 1.8G 1.7G 63M 43M 9.7M 140M -/+ buffers/cache: 1.6G 213M Swap: 0B 0B 0B [root@xxxx ~]# mkdir /swapfile [root@xxxx ~]# cd /swapfile [root@xxxx swapfile]# sudo dd if=/dev/zero of=swap bs=1024 count=2000000 2000000+0 records in 2000000+0 records out 2048000000 bytes (2.0 GB) copied, 39.1198 s, 52.4 MB/s [root@xxxx swapfile]# sudo mkswap -f swap Setting up swapspace version 1, size = 1999996 KiB no label, UUID=75b00bde-7aed-48f3-b373-126a2054ad26 [root@xxxx swapfile]# sudo swapon swap swapon: /swapfile/swap: insecure permissions 0644, 0600 suggested. [root@xxxx swapfile]# free -h total used free shared buffers cached Mem: 1.8G 1.7G 93M 43M 1.2M 23M -/+ buffers/cache: 1.7G 118M Swap: 1.9G 0B 1.9G [root@xxx swapfile]#
修改后再次查看,果断地出来了,记录于此。
扫描公众号,关注更多信息
---------------------------------------------------------------------------------我是分割线--------------------------------------------------------------------------to be a better me, talk is cheap show me the code
版权所有,转载请注明原文链接。
文中有不妥或者错误的地方还望指出,以免误人子弟。如果觉得本文对你有所帮助不妨【推荐】一下!如果你有更好的建议,可以给我留言讨论,共同进步!
再次感谢您耐心的读完本篇文章。
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?