go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.61k stars 5.45k forks source link

a lot of CGroup and threads from gitea #13324

Closed thisisusernameforgithub closed 3 years ago

thisisusernameforgithub commented 3 years ago

after 2 months of continuous running gitea i see the following:

service gitea status -l Redirecting to /bin/systemctl status -l gitea.service ● gitea.service - Gitea (Git with a cup of tea) Loaded: loaded (/etc/systemd/system/gitea.service; enabled; vendor preset: disabled) Active: active (running) since Чт 2020-08-27 15:31:30 MSK; 1 months 29 days ago Main PID: 25509 (gitea) CGroup: /system.slice/gitea.service ├─ 601 git-upload-pack company/fzd.git ├─ 602 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset ├─ 3613 git-upload-pack company/ros.git ├─ 3615 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset --include-tag ├─ 4440 /opt/gitea/gitea serv key-261 --config=/opt/gitea/custom/conf/app.ini ├─ 4449 git-upload-pack company/compan.git ├─ 4452 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset ├─ 5545 /opt/gitea/gitea serv key-65 --config=/opt/gitea/custom/conf/app.ini ├─ 5554 git-upload-pack company/fzd.git ├─ 5555 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset ├─ 6291 /opt/gitea/gitea serv key-6 --config=/opt/gitea/custom/conf/app.ini ├─ 6299 git-upload-pack company/ffk.git ├─ 6301 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset ├─ 7400 git-upload-pack company/open-new.git ├─ 7401 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --delta-base-offset --include-tag ├─10197 /opt/gitea/gitea serv key-57 --config=/opt/gitea/custom/conf/app.ini ├─10206 git-upload-pack company/open-new.git ├─10207 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --delta-base-offset --include-tag ├─11134 git-upload-pack company/comcompan72.git ├─11135 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset ├─13022 /usr/bin/git upload-pack --stateless-rpc /mnt/git/users/company/open-new.git ├─13023 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset --include-tag ├─13540 git-upload-pack company/open-new.git ├─13542 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset --include-tag ├─14275 /opt/gitea/gitea serv key-196 --config=/opt/gitea/custom/conf/app.ini ├─14284 git-upload-pack company/open-new.git ├─14285 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset --include-tag ├─14762 /opt/gitea/gitea serv key-235 --config=/opt/gitea/custom/conf/app.ini ├─14771 git-upload-pack company/compan.git ├─14774 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset ├─16626 git-upload-pack company/open-new.git ├─16628 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset --include-tag ├─17710 /opt/gitea/gitea serv key-235 --config=/opt/gitea/custom/conf/app.ini ├─17719 git-upload-pack company/open-new ├─17721 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset ├─17938 /opt/gitea/gitea serv key-57 --config=/opt/gitea/custom/conf/app.ini ├─17947 git-upload-pack company/open-new.git ├─17948 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --delta-base-offset ├─18109 git-upload-pack company/open-new ├─18110 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset --include-tag ├─19032 git-upload-pack company/open-new ├─19033 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset --include-tag ├─19424 /opt/gitea/gitea serv key-101 --config=/opt/gitea/custom/conf/app.ini ├─19432 git-upload-pack company/ffk.git ├─19434 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset ├─20979 /opt/gitea/gitea serv key-196 --config=/opt/gitea/custom/conf/app.ini ├─20987 git-upload-pack company/open-new.git ├─20989 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset ├─21451 /opt/gitea/gitea serv key-196 --config=/opt/gitea/custom/conf/app.ini ├─21460 git-upload-pack company/open-new.git ├─21464 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset --include-tag ├─23039 /opt/gitea/gitea serv key-235 --config=/opt/gitea/custom/conf/app.ini ├─23048 git-upload-pack company/open-new ├─23049 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset --include-tag ├─23502 /opt/gitea/gitea serv key-196 --config=/opt/gitea/custom/conf/app.ini ├─23507 /opt/gitea/gitea serv key-235 --config=/opt/gitea/custom/conf/app.ini ├─23516 git-upload-pack company/open-new ├─23517 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset ├─23520 git-upload-pack company/open-new.git ├─23522 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset --include-tag ├─24905 /opt/gitea/gitea serv key-238 --config=/opt/gitea/custom/conf/app.ini ├─24914 git-upload-pack company/rusalex.git ├─25509 /opt/gitea/gitea web -c /opt/gitea/custom/conf/app.ini ├─25616 /opt/gitea/gitea serv key-249 --config=/opt/gitea/custom/conf/app.ini ├─25624 git-upload-pack company/open-new ├─25625 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset ├─26480 git-upload-pack company/open-new ├─26481 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset ├─26577 git-upload-pack company/open-new ├─26578 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset ├─27417 git-upload-pack company/fzd.git ├─27419 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset --include-tag ├─27745 git-upload-pack company/compan.git ├─27747 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset --include-tag ├─32342 /opt/gitea/gitea serv key-65 --config=/opt/gitea/custom/conf/app.ini ├─32350 git-upload-pack company/comcompan72.git └─32457 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset --include-tag

окт 26 19:39:37 vm.git gitea[25509]: [Macaron] 2020-10-26 19:39:37: Started HEAD / for 11.2.11.33 окт 26 19:39:37 vm.git gitea[25509]: [Macaron] 2020-10-26 19:39:37: Completed HEAD / 200 OK in 600.975µs окт 26 19:39:38 vm.git gitea[25509]: [Macaron] 2020-10-26 19:39:38: Started GET /COMPANY/compan.git/info/refs?service=git-upload-pack for 11.2.11.38 окт 26 19:39:38 vm.git gitea[25509]: [Macaron] 2020-10-26 19:39:38: Completed GET /COMPANY/compan.git/info/refs?service=git-upload-pack 401 Unauthorized in 3.385749ms окт 26 19:39:38 vm.git gitea[25509]: [Macaron] 2020-10-26 19:39:38: Started GET /COMPANY/compan.git/info/refs?service=git-upload-pack for 11.2.11.38 окт 26 19:39:38 vm.git gitea[25509]: [Macaron] 2020-10-26 19:39:38: Completed GET /COMPANY/compan.git/info/refs?service=git-upload-pack 200 OK in 169.914134ms окт 26 19:39:46 vm.git gitea[25509]: [Macaron] 2020-10-26 19:39:46: Started HEAD / for 11.2.11.33 окт 26 19:39:46 vm.git gitea[25509]: [Macaron] 2020-10-26 19:39:46: Completed HEAD / 200 OK in 706.734µs окт 26 19:42:06 vm.git gitea[25509]: [Macaron] 2020-10-26 19:42:06: Started GET /user/events for 11.2.11.102 окт 26 19:42:34 vm.git gitea[25509]: [Macaron] 2020-10-26 19:42:34: Completed GET /user/events 200 OK in 28.586127045s

After restarting gitea, the situation has improved

service gitea status -l Redirecting to /bin/systemctl status -l gitea.service gitea.service - Gitea (Git with a cup of tea) Loaded: loaded (/etc/systemd/system/gitea.service; enabled; vendor preset: disabled) Active: active (running) since Пн 2020-10-26 19:47:08 MSK; 20h ago Main PID: 26797 (gitea) CGroup: /system.slice/gitea.service ├─26797 /opt/gitea/gitea web -c /opt/gitea/custom/conf/app.ini ├─27159 /opt/gitea/gitea serv key-196 --config=/opt/gitea/custom/conf/app.ini ├─27168 git-upload-pack company/open-new.git └─27170 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset --include-tag

my top -H

top - 19:44:49 up 64 days, 22:34, 1 user, load average: 0,08, 0,14, 1,65 Threads: 432 total, 2 running, 418 sleeping, 0 stopped, 12 zombie

What can be wrong? Why is CGroup growing so: /system.slice/gitea.service

And a large number of threads - 418 sleeping & 12 zombie

zeripath commented 3 years ago

Please update gitea to the latest version - that is 1.12.5.

All of these cgroup threads are running git pack-objects. That is a child process of git gc

Gitea runs git gc regularly so these will be related to that.

thisisusernameforgithub commented 3 years ago

Please update gitea to the latest version - that is 1.12.5.

All of these cgroup threads are running git pack-objects. That is a child process of git gc

Gitea runs git gc regularly so these will be related to that.

how can you get rid of such anomalous activity? it seems that these processes are started and not completed on time, but simply hang, creating a load

zeripath commented 3 years ago

You don't state what kind of system you are running on but git pack objects can hang if packs become too large for the available memory. That would require setting the global git settings for pack objects which are described in the git documentation.

In terms of these I suggest you bring down Gitea and run git gc on the repositories on the command line. (You can do this whilst Gitea is running if preferred - but you'll need to kill these broken child processes.)

thisisusernameforgithub commented 3 years ago

You don't state what kind of system you are running on but git pack objects can hang if packs become too large for the available memory. That would require setting the global git settings for pack objects which are described in the git documentation.

In terms of these I suggest you bring down Gitea and run git gc on the repositories on the command line. (You can do this whilst Gitea is running if preferred - but you'll need to kill these broken child processes.)

You don't state what kind of system you are running on

Thank you for the answer! What kind of system are you talking about?

my Gitea version: 1.12.3 my Git version: 2.22.0 my OS: Centos 7.8

zeripath commented 3 years ago

I mean are you running on a raspberry pi, a server with limited memory, over NFS or some sort of other slightly restricted case etc.

thisisusernameforgithub commented 3 years ago

I mean are you running on a raspberry pi, a server with limited memory, over NFS or some sort of other slightly restricted case etc.

this works on a hardware server with a normal amount of RAM and a normal processor. tell me how can i avoid hung processes and a large number of CGroups?

zeripath commented 3 years ago

I suspect that there is an issue with your git garbage collection.

... I suggest you bring down Gitea and run git gc on the repositories on the command line. (You can do this whilst Gitea is running if preferred - but you'll need to kill these broken child processes.)

Did you do the above?

thisisusernameforgithub commented 3 years ago

at the moment gitea has been active for almost 3 months and there are no crooked/frozen processes in the daemon branch (probably influenced by the update to version 1.12.3 and rescans of the database and repos after it) I think the problem is more irrelevant


service gitea status -l
Redirecting to /bin/systemctl status gitea.service
● gitea.service - Gitea (Git with a cup of tea)
   Loaded: loaded (/etc/systemd/system/gitea.service; enabled; vendor preset: disabled)
   Active: active (running) since Чт 2021-01-07 15:15:23 MSK; 2 months 17 days ago
 Main PID: 11574 (gitea)
   CGroup: /system.slice/gitea.service
           ├─ 4348 /opt/gitea/gitea serv key-196 --config=/opt/gitea/custom/conf/app.ini
           ├─ 4357 git-upload-pack tp/open.git
           ├─ 4358 /usr/libexec/git-core/git pack-objects --revs --thin --stdout --progress --delta-base-offset
           └─11574 /opt/gitea/gitea web -c /opt/gitea/custom/conf/app.ini

мар 26 16:19:30 vm01.git gitea[11574]: [Macaron] 2021-03-26 16:19:30: Started GET /P/co.git/info/refs?service=git-upload-pack for 10.4.5.22
мар 26 16:19:30 vm01.git gitea[11574]: [Macaron] 2021-03-26 16:19:30: Completed GET /TP/co.git/info/refs?service=git-upload-pack 200 OK in 56.85053ms
мар 26 16:20:12 vm01.git gitea[11574]: [Macaron] 2021-03-26 16:20:12: Started GET /api/internal/serv/command/255/tp/fz?mode=1&verb=git-upload-pack for 127.0.0.1
мар 26 16:20:12 vm01.git gitea[11574]: [Macaron] 2021-03-26 16:20:12: Completed GET /api/internal/serv/command/255/tp/fz?mode=1&verb=git-upload-pack 20...9.806863ms
мар 26 16:20:12 vm01.git gitea[11574]: [Macaron] 2021-03-26 16:20:12: Started POST /api/internal/ssh/255/update/46 for 127.0.0.1
мар 26 16:20:12 vm01.git gitea[11574]: [Macaron] 2021-03-26 16:20:12: Completed POST /api/internal/ssh/255/update/46 200 OK in 2.650697ms
мар 26 16:20:15 vm01.git gitea[11574]: [Macaron] 2021-03-26 16:20:15: Started GET /api/internal/serv/command/196/tp/open?mode=1&verb=git-upload-pack for 127.0.0.1
мар 26 16:20:15 vm01.git gitea[11574]: [Macaron] 2021-03-26 16:20:15: Completed GET /api/internal/serv/command/196/tp/open?mode=1&verb=git-upload-pack... 9.68546ms
мар 26 16:20:16 vm01.git gitea[11574]: [Macaron] 2021-03-26 16:20:16: Started POST /api/internal/ssh/196/update/19 for 127.0.0.1
мар 26 16:20:16 vm01.git gitea[11574]: [Macaron] 2021-03-26 16:20:16: Completed POST /api/internal/ssh/196/update/19 200 OK in 2.981946ms