problem: resource limit for git processes #12390

Open
opened 2026-05-03 02:41:01 +02:00 by Gusted · 0 comments
Gusted commented 2026-05-03 02:41:01 +02:00 (Migrated from codeberg.org)

Does your problem still exist on the latest Forgejo version?

Yes, the problem still exists (tested locally with the latest development version)

About your usage of Forgejo

Contributor of Forgejo
Member of the Forgejo security team.
Self-hosts Forgejo.
Co-Maintainer of Codeberg.org's Forgejo instance.

Problem description

This is issue was created as part of https://floss.social/@forgejo/116494296646568723.


Forgejo is a Git forge, and Forgejo interacts with Git via the git binary1. This means that for a operation that involves git in some way, Forgejo executes the git binary. The implementation of git is surprisingly efficient, but still for some operations it simply has to do a lot of work in terms of CPU and memory.

Forgejo puts no resource limit on the spawned git processes. This means that if you're asking git to do a expensive operation on large repositories, it can take all cpu cores and memory to do that work which generally results in. On Codeberg we see this quite often, most are due to crawler behavior of expensive endpoints but also genuine git clones, push, archives on large repositories. And when such git process is taking a lot of resources, it's a unfair share of the available resources and can make appear that Forgejo is slow as the system is technically under heavy load by this git process.

Potential workarounds

Forgejo Version

N/A

Other details about your environment (software names and versions)

N/A

Solutions

Accepted solutions to address this problem will go here


  1. For context, go-git was supported at some point but was not faster and is lacking behind on newer features from git. CGO via libgit2 was never supported, and also lacks many features that we require. ↩︎

### Does your problem still exist on the latest Forgejo version? Yes, the problem still exists (tested locally with the latest development version) ### About your usage of Forgejo Contributor of Forgejo Member of the Forgejo security team. Self-hosts Forgejo. Co-Maintainer of Codeberg.org's Forgejo instance. ### Problem description This is issue was created as part of https://floss.social/@forgejo/116494296646568723. --- Forgejo is a Git forge, and Forgejo interacts with Git via the `git` binary[^1]. This means that for a operation that involves git in some way, Forgejo executes the `git` binary. The implementation of git is surprisingly efficient, but still for some operations it simply has to do a lot of work in terms of CPU and memory. Forgejo puts no resource limit on the spawned git processes. This means that if you're asking git to do a expensive operation on large repositories, it can take all cpu cores and memory to do that work which generally results in. On Codeberg we see this quite often, most are due to crawler behavior of expensive endpoints but also genuine git clones, push, archives on large repositories. And when such git process is taking a lot of resources, it's a unfair share of the available resources and can make appear that Forgejo is slow as the system is technically under heavy load by this git process. [^1]: For context, [go-git](https://github.com/go-git/go-git/) was supported at some point but was not faster and is lacking behind on newer features from git. CGO via [libgit2](https://github.com/libgit2/libgit2) was never supported, and also lacks many features that we require. ### Potential workarounds - Renice git process on a regular small interval. https://codeberg.org/Codeberg-Infrastructure/scripted-configuration/src/branch/main/hosts/forgejo-prod-main/usr/local/bin/git-renice.sh - Implement cgroups for git processes as is done by Gitlab, https://docs.gitlab.com/administration/gitaly/cgroups/ ### Forgejo Version N/A ### Other details about your environment (software names and versions) N/A ### Solutions *Accepted solutions to address this problem will go here*
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sleepy/forgejo#12390
No description provided.