[question] gitea used too much memory and slow response #5570

Closed
opened 2025-11-02 06:29:14 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @fawdlstty on GitHub (Jun 18, 2020).

  • Gitea version (or commit ref): 1.12
  • Git version:
  • Operating system: centos 7.5
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

The version 1.10 I used was upgraded to 1.12. There was no problem with the previous version. The upgraded version took up at least 500M memory and frequently made the CPU reach 100%, which slowed down the speed of web service requesting GITEA and affected other software running on the current host

Screenshots

I use top command, and sorry for no screenhost

Originally created by @fawdlstty on GitHub (Jun 18, 2020). - Gitea version (or commit ref): 1.12 - Git version: - Operating system: centos 7.5 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - [ ] Not relevant - Log gist: ## Description The version 1.10 I used was upgraded to 1.12. There was no problem with the previous version. The upgraded version took up at least 500M memory and frequently made the CPU reach 100%, which slowed down the speed of web service requesting GITEA and affected other software running on the current host ## Screenshots I use `top` command, and sorry for no screenhost
GiteaMirror added the issue/duplicate label 2025-11-02 06:29:14 -06:00
Author
Owner

@lunny commented on GitHub (Jun 18, 2020):

Could you find something on admin panel -> tasks ?

@lunny commented on GitHub (Jun 18, 2020): Could you find something on admin panel -> tasks ?
Author
Owner

@fawdlstty commented on GitHub (Jun 18, 2020):

image
image

@fawdlstty commented on GitHub (Jun 18, 2020): ![image](https://user-images.githubusercontent.com/7323999/85026923-e18f2480-b1ab-11ea-9e18-89f683b01ace.png) ![image](https://user-images.githubusercontent.com/7323999/85026960-f1a70400-b1ab-11ea-85e8-9ade29715a4a.png)
Author
Owner

@fawdlstty commented on GitHub (Jun 18, 2020):

image

@fawdlstty commented on GitHub (Jun 18, 2020): ![image](https://user-images.githubusercontent.com/7323999/85027240-464a7f00-b1ac-11ea-9ed8-e3c0e782e356.png)
Author
Owner

@jerrykan commented on GitHub (Jun 19, 2020):

I'm experiencing the same thing on Debian 9/stretch using a PostgreSQL v12 backend. Also just upgraded from Gitea v1.10.3.

The Gitea service starts, proceeds to use up almost 2GB RAM within a minute or so and then crashes when it runs out of memory.

Output from journalctl below:

Jun 19 20:20:07 host systemd[1]: Started Gitea (A painless self-hosted Git service).
Jun 19 20:20:08 host gitea[9577]: 2020/06/19 20:20:08 cmd/web.go:107:runWeb() [I] Starting Gitea on PID: 9577
Jun 19 20:20:08 host gitea[9577]: 2020/06/19 20:20:08 ...dules/setting/git.go:93:newGit() [I] Git Version: 2.11.0
Jun 19 20:20:08 host gitea[9577]: 2020/06/19 20:20:08 routers/init.go:119:GlobalInit() [T] AppPath: /opt/gitea/gitea
Jun 19 20:20:08 host gitea[9577]: 2020/06/19 20:20:08 routers/init.go:120:GlobalInit() [T] AppWorkPath: /var/lib/gitea
Jun 19 20:20:08 host gitea[9577]: 2020/06/19 20:20:08 routers/init.go:121:GlobalInit() [T] Custom path: /var/lib/gitea/custom
Jun 19 20:20:08 host gitea[9577]: 2020/06/19 20:20:08 routers/init.go:122:GlobalInit() [T] Log path: /var/log/gitea
Jun 19 20:20:08 host gitea[9577]: 2020/06/19 20:20:08 routers/init.go:127:GlobalInit() [I] Delete all repository archives
Jun 19 20:20:08 host gitea[9577]: 2020/06/19 20:20:08 ...dules/setting/log.go:233:newLogService() [I] Gitea v1.12.0 built with GNU Make 4.1, go1.14.4 : bindata, sqlite, sqlite_unlock_notify
Jun 19 20:20:43 host gitea[9577]: [Macaron] 2020-06-19 20:20:43: Started GET /admin/monitor for 172.18.0.2
Jun 19 20:20:44 host gitea[9577]: [Macaron] 2020-06-19 20:20:44: Started GET /api/internal/serv/command/81/<redacted org>/<redacted repo1>?mode=1&verb=git-upload-pack for 127.0.0.1
Jun 19 20:20:46 host gitea[9577]: [Macaron] 2020-06-19 20:20:46: Started GET /api/internal/serv/command/81/<redacted org>/<redacted repo2>?mode=1&verb=git-upload-pack for 127.0.0.1
Jun 19 20:20:48 host gitea[9577]: [Macaron] 2020-06-19 20:20:48: Started GET /api/internal/serv/command/9/<redacted org>/<redacted repo3>?mode=1&verb=git-upload-pack for 127.0.0.1
Jun 19 20:20:49 host gitea[9577]: fatal error: runtime: out of memory
Jun 19 20:20:49 host gitea[9577]: runtime stack:
Jun 19 20:20:49 host gitea[9577]: runtime.throw(0x23a0f94, 0x16)
Jun 19 20:20:49 host gitea[9577]:         /usr/local/go/src/runtime/panic.go:1116 +0x72
Jun 19 20:20:49 host gitea[9577]: runtime.sysMap(0xc088000000, 0x2c000000, 0x597c898)
Jun 19 20:20:49 host gitea[9577]:         /usr/local/go/src/runtime/mem_linux.go:169 +0xc5
Jun 19 20:20:49 host gitea[9577]: runtime.(*mheap).sysAlloc(0x595ffe0, 0x2c000000, 0x595ffe8, 0x15e30)
Jun 19 20:20:49 host gitea[9577]:         /usr/local/go/src/runtime/malloc.go:715 +0x1cd
Jun 19 20:20:49 host gitea[9577]: runtime.(*mheap).grow(0x595ffe0, 0x15e30, 0x0)
Jun 19 20:20:49 host gitea[9577]:         /usr/local/go/src/runtime/mheap.go:1286 +0x11c
Jun 19 20:20:49 host gitea[9577]: runtime.(*mheap).allocSpan(0x595ffe0, 0x15e30, 0x420100, 0x597c8a8, 0x7fccfbffec00)
Jun 19 20:20:49 host gitea[9577]:         /usr/local/go/src/runtime/mheap.go:1124 +0x6a0
Jun 19 20:20:49 host gitea[9577]: runtime.(*mheap).alloc.func1()
Jun 19 20:20:49 host gitea[9577]:         /usr/local/go/src/runtime/mheap.go:871 +0x64
Jun 19 20:20:49 host gitea[9577]: runtime.(*mheap).alloc(0x595ffe0, 0x15e30, 0xc007490001, 0xc002a19680)
Jun 19 20:20:49 host gitea[9577]:         /usr/local/go/src/runtime/mheap.go:865 +0x81
Jun 19 20:20:49 host gitea[9577]: runtime.largeAlloc(0x2bc60000, 0x100, 0xc00749c601)
Jun 19 20:20:49 host gitea[9577]:         /usr/local/go/src/runtime/malloc.go:1152 +0x92
Jun 19 20:20:49 host gitea[9577]: runtime.mallocgc.func1()
Jun 19 20:20:49 host gitea[9577]:         /usr/local/go/src/runtime/malloc.go:1047 +0x46
Jun 19 20:20:49 host gitea[9577]: runtime.systemstack(0x0)
Jun 19 20:20:49 host gitea[9577]:         /usr/local/go/src/runtime/asm_amd64.s:370 +0x66
Jun 19 20:20:49 host gitea[9577]: runtime.mstart()
Jun 19 20:20:49 host gitea[9577]:         /usr/local/go/src/runtime/proc.go:1041
Jun 19 20:20:49 host gitea[9577]: goroutine 882 [running]:
Jun 19 20:20:49 host gitea[9577]: runtime.systemstack_switch()
Jun 19 20:20:49 host gitea[9577]:         /usr/local/go/src/runtime/asm_amd64.s:330 fp=0xc003075350 sp=0xc003075348 pc=0x46cf10
Jun 19 20:20:49 host gitea[9577]: runtime.mallocgc(0x2bc60000, 0x0, 0xc08e2ec800, 0xc0087c4000)
Jun 19 20:20:49 host gitea[9577]:         /usr/local/go/src/runtime/malloc.go:1046 +0x895 fp=0xc0030753f0 sp=0xc003075350 pc=0x4144f5
Jun 19 20:20:49 host gitea[9577]: runtime.growslice(0x1eb6a80, 0xc0525bc000, 0x23048000, 0x2304c000, 0x23050000, 0xc0525bc000, 0x1c038000, 0x8000)
Jun 19 20:20:49 host gitea[9577]:         /usr/local/go/src/runtime/slice.go:175 +0x14e fp=0xc003075458 sp=0xc0030753f0 pc=0x45402e
Jun 19 20:20:49 host gitea[9577]: code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing.(*MemoryObject).Write(0xc0078c2100, 0xc0087c4000, 0x8000, 0x8000, 0x8000, 0x0, 0x0)
Jun 19 20:20:49 host gitea[9577]:         /go/src/code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing/memory.go:53 +0xfd fp=0xc0030754c0 sp=0xc003075458 pc=0x78b04d
Jun 19 20:20:49 host gitea[9577]: io.copyBuffer(0x7fcd101971c0, 0xc0078c2100, 0x7fcd10197180, 0xc0029f79f0, 0xc0087c4000, 0x8000, 0x8000, 0x1ffc180, 0xc003095500, 0x7fcd10197180)
Jun 19 20:20:49 host gitea[9577]:         /usr/local/go/src/io/io.go:407 +0x1fb fp=0xc003075538 sp=0xc0030754c0 pc=0x4b372b
Jun 19 20:20:49 host gitea[9577]: io.CopyBuffer(0x7fcd101971c0, 0xc0078c2100, 0x7fcd10197180, 0xc0029f79f0, 0xc0087c4000, 0x8000, 0x8000, 0x0, 0x0, 0xc003095628)
Jun 19 20:20:49 host gitea[9577]:         /usr/local/go/src/io/io.go:378 +0x82 fp=0xc003075598 sp=0xc003075538 pc=0x4b34c2
Jun 19 20:20:49 host gitea[9577]: code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing/format/packfile.(*Scanner).copyObject(0xc002fb2d80, 0x7fcd101971c0, 0xc0078c2100, 0x0, 0x0, 0x0)
Jun 19 20:20:49 host gitea[9577]:         /go/src/code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing/format/packfile/scanner.go:335 +0x339 fp=0xc003075678 sp=0xc003075598 pc=0x884889
Jun 19 20:20:49 host gitea[9577]: code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing/format/packfile.(*Scanner).NextObject(0xc002fb2d80, 0x7fcd101971c0, 0xc0078c2100, 0x7fcd101971c0, 0xc0078c2100, 0x175b9b8, 0xc003095748)
Jun 19 20:20:49 host gitea[9577]:         /go/src/code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing/format/packfile/scanner.go:314 +0x5a fp=0xc0030756d8 sp=0xc003075678 pc=0x88448a
Jun 19 20:20:49 host gitea[9577]: code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing/format/packfile.(*Packfile).fillRegularObjectContent(0xc00c351950, 0x3ffb860, 0xc0078c2100, 0x0, 0x0)
Jun 19 20:20:49 host gitea[9577]:         /go/src/code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing/format/packfile/packfile.go:319 +0x132 fp=0xc003075760 sp=0xc0030756d8 pc=0x87e4e2
Jun 19 20:20:49 host gitea[9577]: code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing/format/packfile.(*Packfile).getNextMemoryObject(0xc00c351950, 0xc00427f940, 0xc00427f940, 0x0, 0x0, 0xc002fb2db0)
Jun 19 20:20:49 host gitea[9577]:         /go/src/code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing/format/packfile/packfile.go:293 +0x2e3 fp=0xc003075800 sp=0xc003075760 pc=0x87e393
Jun 19 20:20:49 host gitea[9577]: code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing/format/packfile.(*Packfile).getObjectContent(0xc00c351950, 0x128363b, 0x0, 0x0, 0x40013e0, 0xc009c8e360)
@jerrykan commented on GitHub (Jun 19, 2020): I'm experiencing the same thing on Debian 9/stretch using a PostgreSQL v12 backend. Also just upgraded from Gitea v1.10.3. The Gitea service starts, proceeds to use up almost 2GB RAM within a minute or so and then crashes when it runs out of memory. Output from journalctl below: ``` Jun 19 20:20:07 host systemd[1]: Started Gitea (A painless self-hosted Git service). Jun 19 20:20:08 host gitea[9577]: 2020/06/19 20:20:08 cmd/web.go:107:runWeb() [I] Starting Gitea on PID: 9577 Jun 19 20:20:08 host gitea[9577]: 2020/06/19 20:20:08 ...dules/setting/git.go:93:newGit() [I] Git Version: 2.11.0 Jun 19 20:20:08 host gitea[9577]: 2020/06/19 20:20:08 routers/init.go:119:GlobalInit() [T] AppPath: /opt/gitea/gitea Jun 19 20:20:08 host gitea[9577]: 2020/06/19 20:20:08 routers/init.go:120:GlobalInit() [T] AppWorkPath: /var/lib/gitea Jun 19 20:20:08 host gitea[9577]: 2020/06/19 20:20:08 routers/init.go:121:GlobalInit() [T] Custom path: /var/lib/gitea/custom Jun 19 20:20:08 host gitea[9577]: 2020/06/19 20:20:08 routers/init.go:122:GlobalInit() [T] Log path: /var/log/gitea Jun 19 20:20:08 host gitea[9577]: 2020/06/19 20:20:08 routers/init.go:127:GlobalInit() [I] Delete all repository archives Jun 19 20:20:08 host gitea[9577]: 2020/06/19 20:20:08 ...dules/setting/log.go:233:newLogService() [I] Gitea v1.12.0 built with GNU Make 4.1, go1.14.4 : bindata, sqlite, sqlite_unlock_notify Jun 19 20:20:43 host gitea[9577]: [Macaron] 2020-06-19 20:20:43: Started GET /admin/monitor for 172.18.0.2 Jun 19 20:20:44 host gitea[9577]: [Macaron] 2020-06-19 20:20:44: Started GET /api/internal/serv/command/81/<redacted org>/<redacted repo1>?mode=1&verb=git-upload-pack for 127.0.0.1 Jun 19 20:20:46 host gitea[9577]: [Macaron] 2020-06-19 20:20:46: Started GET /api/internal/serv/command/81/<redacted org>/<redacted repo2>?mode=1&verb=git-upload-pack for 127.0.0.1 Jun 19 20:20:48 host gitea[9577]: [Macaron] 2020-06-19 20:20:48: Started GET /api/internal/serv/command/9/<redacted org>/<redacted repo3>?mode=1&verb=git-upload-pack for 127.0.0.1 Jun 19 20:20:49 host gitea[9577]: fatal error: runtime: out of memory Jun 19 20:20:49 host gitea[9577]: runtime stack: Jun 19 20:20:49 host gitea[9577]: runtime.throw(0x23a0f94, 0x16) Jun 19 20:20:49 host gitea[9577]: /usr/local/go/src/runtime/panic.go:1116 +0x72 Jun 19 20:20:49 host gitea[9577]: runtime.sysMap(0xc088000000, 0x2c000000, 0x597c898) Jun 19 20:20:49 host gitea[9577]: /usr/local/go/src/runtime/mem_linux.go:169 +0xc5 Jun 19 20:20:49 host gitea[9577]: runtime.(*mheap).sysAlloc(0x595ffe0, 0x2c000000, 0x595ffe8, 0x15e30) Jun 19 20:20:49 host gitea[9577]: /usr/local/go/src/runtime/malloc.go:715 +0x1cd Jun 19 20:20:49 host gitea[9577]: runtime.(*mheap).grow(0x595ffe0, 0x15e30, 0x0) Jun 19 20:20:49 host gitea[9577]: /usr/local/go/src/runtime/mheap.go:1286 +0x11c Jun 19 20:20:49 host gitea[9577]: runtime.(*mheap).allocSpan(0x595ffe0, 0x15e30, 0x420100, 0x597c8a8, 0x7fccfbffec00) Jun 19 20:20:49 host gitea[9577]: /usr/local/go/src/runtime/mheap.go:1124 +0x6a0 Jun 19 20:20:49 host gitea[9577]: runtime.(*mheap).alloc.func1() Jun 19 20:20:49 host gitea[9577]: /usr/local/go/src/runtime/mheap.go:871 +0x64 Jun 19 20:20:49 host gitea[9577]: runtime.(*mheap).alloc(0x595ffe0, 0x15e30, 0xc007490001, 0xc002a19680) Jun 19 20:20:49 host gitea[9577]: /usr/local/go/src/runtime/mheap.go:865 +0x81 Jun 19 20:20:49 host gitea[9577]: runtime.largeAlloc(0x2bc60000, 0x100, 0xc00749c601) Jun 19 20:20:49 host gitea[9577]: /usr/local/go/src/runtime/malloc.go:1152 +0x92 Jun 19 20:20:49 host gitea[9577]: runtime.mallocgc.func1() Jun 19 20:20:49 host gitea[9577]: /usr/local/go/src/runtime/malloc.go:1047 +0x46 Jun 19 20:20:49 host gitea[9577]: runtime.systemstack(0x0) Jun 19 20:20:49 host gitea[9577]: /usr/local/go/src/runtime/asm_amd64.s:370 +0x66 Jun 19 20:20:49 host gitea[9577]: runtime.mstart() Jun 19 20:20:49 host gitea[9577]: /usr/local/go/src/runtime/proc.go:1041 Jun 19 20:20:49 host gitea[9577]: goroutine 882 [running]: Jun 19 20:20:49 host gitea[9577]: runtime.systemstack_switch() Jun 19 20:20:49 host gitea[9577]: /usr/local/go/src/runtime/asm_amd64.s:330 fp=0xc003075350 sp=0xc003075348 pc=0x46cf10 Jun 19 20:20:49 host gitea[9577]: runtime.mallocgc(0x2bc60000, 0x0, 0xc08e2ec800, 0xc0087c4000) Jun 19 20:20:49 host gitea[9577]: /usr/local/go/src/runtime/malloc.go:1046 +0x895 fp=0xc0030753f0 sp=0xc003075350 pc=0x4144f5 Jun 19 20:20:49 host gitea[9577]: runtime.growslice(0x1eb6a80, 0xc0525bc000, 0x23048000, 0x2304c000, 0x23050000, 0xc0525bc000, 0x1c038000, 0x8000) Jun 19 20:20:49 host gitea[9577]: /usr/local/go/src/runtime/slice.go:175 +0x14e fp=0xc003075458 sp=0xc0030753f0 pc=0x45402e Jun 19 20:20:49 host gitea[9577]: code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing.(*MemoryObject).Write(0xc0078c2100, 0xc0087c4000, 0x8000, 0x8000, 0x8000, 0x0, 0x0) Jun 19 20:20:49 host gitea[9577]: /go/src/code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing/memory.go:53 +0xfd fp=0xc0030754c0 sp=0xc003075458 pc=0x78b04d Jun 19 20:20:49 host gitea[9577]: io.copyBuffer(0x7fcd101971c0, 0xc0078c2100, 0x7fcd10197180, 0xc0029f79f0, 0xc0087c4000, 0x8000, 0x8000, 0x1ffc180, 0xc003095500, 0x7fcd10197180) Jun 19 20:20:49 host gitea[9577]: /usr/local/go/src/io/io.go:407 +0x1fb fp=0xc003075538 sp=0xc0030754c0 pc=0x4b372b Jun 19 20:20:49 host gitea[9577]: io.CopyBuffer(0x7fcd101971c0, 0xc0078c2100, 0x7fcd10197180, 0xc0029f79f0, 0xc0087c4000, 0x8000, 0x8000, 0x0, 0x0, 0xc003095628) Jun 19 20:20:49 host gitea[9577]: /usr/local/go/src/io/io.go:378 +0x82 fp=0xc003075598 sp=0xc003075538 pc=0x4b34c2 Jun 19 20:20:49 host gitea[9577]: code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing/format/packfile.(*Scanner).copyObject(0xc002fb2d80, 0x7fcd101971c0, 0xc0078c2100, 0x0, 0x0, 0x0) Jun 19 20:20:49 host gitea[9577]: /go/src/code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing/format/packfile/scanner.go:335 +0x339 fp=0xc003075678 sp=0xc003075598 pc=0x884889 Jun 19 20:20:49 host gitea[9577]: code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing/format/packfile.(*Scanner).NextObject(0xc002fb2d80, 0x7fcd101971c0, 0xc0078c2100, 0x7fcd101971c0, 0xc0078c2100, 0x175b9b8, 0xc003095748) Jun 19 20:20:49 host gitea[9577]: /go/src/code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing/format/packfile/scanner.go:314 +0x5a fp=0xc0030756d8 sp=0xc003075678 pc=0x88448a Jun 19 20:20:49 host gitea[9577]: code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing/format/packfile.(*Packfile).fillRegularObjectContent(0xc00c351950, 0x3ffb860, 0xc0078c2100, 0x0, 0x0) Jun 19 20:20:49 host gitea[9577]: /go/src/code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing/format/packfile/packfile.go:319 +0x132 fp=0xc003075760 sp=0xc0030756d8 pc=0x87e4e2 Jun 19 20:20:49 host gitea[9577]: code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing/format/packfile.(*Packfile).getNextMemoryObject(0xc00c351950, 0xc00427f940, 0xc00427f940, 0x0, 0x0, 0xc002fb2db0) Jun 19 20:20:49 host gitea[9577]: /go/src/code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing/format/packfile/packfile.go:293 +0x2e3 fp=0xc003075800 sp=0xc003075760 pc=0x87e393 Jun 19 20:20:49 host gitea[9577]: code.gitea.io/gitea/vendor/github.com/go-git/go-git/v5/plumbing/format/packfile.(*Packfile).getObjectContent(0xc00c351950, 0x128363b, 0x0, 0x0, 0x40013e0, 0xc009c8e360) ```
Author
Owner

@lafriks commented on GitHub (Jun 20, 2020):

Fixed by #11969

@lafriks commented on GitHub (Jun 20, 2020): Fixed by #11969
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#5570