mirror of
https://github.com/go-gitea/gitea.git
synced 2026-03-11 17:46:29 -05:00
During git clone, gitea fails with accept4: too many open files; retrying in 1s #15023
Closed
opened 2025-11-02 11:28:14 -06:00 by GiteaMirror
·
23 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16.4
v1.16.3
v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.3.3
v1.4.0-rc1
v1.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
No Label
type/bug
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#15023
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @galets on GitHub (Oct 13, 2025).
Description
Description
While pulling a large repository with LFS, Gitea instance stops responding. Website shows "500 Internal Server Error". Log shows (initially):
Then:
git clone shows:
Once gitea server goes into that condition, it does not self-recover
Also:
Gitea Version
v1.24.6
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
No response
Operating System
Ubuntu 22.04 / Debian 13
How are you running Gitea?
Gitea is running in systemd container (nspawn). Host is running Ubuntu 22.04. Container is running Debian 13.
Database
SQLite
@wxiaoguang commented on GitHub (Oct 14, 2025):
It seems that there are some resource leaking.
@wxiaoguang commented on GitHub (Oct 14, 2025):
Propose a PR to try to fix: LFS SSH: Fix missing Close when error occurs and add more tests #35658
If you can collect more information (for example: when error occurs, what are the leaked resources? file description or tcp socket connection), it would be very helpful.
@galets commented on GitHub (Oct 14, 2025):
I have environment where the issue is reproducible. Can you write me up the steps I need to follow to collect the data you want?
Also, would you like me to deploy the fix you proposed and see if it resolves the issue?
@wxiaoguang commented on GitHub (Oct 14, 2025):
Some tools like
ssorlsofcan help to list the open FD or TCP sockets in a process.For example:
ss -anpandlsof -anp $(pidof gitea)@galets commented on GitHub (Oct 14, 2025):
I dumped the whole lsof, as there weren't many other processes in the container
(Update: deleted the log attachment)
Please let me know if you need anything else. I will restart gitea in a few hours
@galets commented on GitHub (Oct 14, 2025):
Also, something occured to me worth mentioning: a lot of exhausted connections belong to web ui process, not workers:
@wxiaoguang commented on GitHub (Oct 15, 2025):
Hmm, just realized that it's difficult to "catch" a snapshot when the resource leaking occurs.
The reason is that the leaking occurs in the "git hook gitea subcommand" (but not gitea server), when the leaking occurs, git client is likely to exit soon, then the "git hook gitea subcommand" also exits, then everything recovers. It needs a quite good timing to catch the resource leaking in "git hook gitea subcommand" ....
@wxiaoguang commented on GitHub (Oct 15, 2025):
OK, I think we can know the problem is caused by the gitea subcommand to gitea server connection.
There are plenty of these logs:
I guess "Fix missing Close when error occurs and add more tests #35658" might be able to fix. You can restart the server :)
@galets commented on GitHub (Oct 15, 2025):
Would you like me to deploy the commit that fixes is to test?
@wxiaoguang commented on GitHub (Oct 15, 2025):
If you are able to build your own docker image and deploy, it would be quite helpful. Thank you very much.
(And I am still working on it to try to debug more details)
@galets commented on GitHub (Oct 15, 2025):
Can you supply exactly the commit hash?
@wxiaoguang commented on GitHub (Oct 15, 2025):
You can checkout my branch: https://github.com/wxiaoguang/gitea/tree/fix-lfs-ssh
At the moment there is only one commit
db70766908. I might add more commits later if I find something new.@wxiaoguang commented on GitHub (Oct 15, 2025):
If you'd like to apply it to 1.24, the only related change is
modules/lfstransfer/backend/backend.go, others are not directly related.(ps: I think it's also safe to run my
fix-lfs-sshbranch, although it is based on main branch, it should be stable enough and can be switch to 1.25 which is going to be released soon)@galets commented on GitHub (Oct 15, 2025):
I applied following and re-testing now:
@wxiaoguang commented on GitHub (Oct 15, 2025):
Good news, I found a new resource leaking point.
The "http client" is abused, then it creates a lot of "connection pool", every pool holds an open connection.
Will propose a fix soon.
@galets commented on GitHub (Oct 15, 2025):
I confirm that backend.go fix did not resolve the issue, still getting same error
@wxiaoguang commented on GitHub (Oct 15, 2025):
I think (highly likely) this patch will fix, just add two
DisableKeepAlives: true:@galets commented on GitHub (Oct 15, 2025):
Trying following (previous change rolled back):
@galets commented on GitHub (Oct 15, 2025):
As checkout is at 96%:
@galets commented on GitHub (Oct 15, 2025):
git cloneis complete, the fix is working@wxiaoguang commented on GitHub (Oct 15, 2025):
Thank you very much, you can keep the quick patch for your instance.
I will try to make a complete fix (it would be more complex and needs some time)
@wxiaoguang commented on GitHub (Oct 15, 2025):
Made more changes, IMO the complete fix should be like this: Fix missing Close when error occurs and abused connection pool #35658
@wxiaoguang commented on GitHub (Oct 15, 2025):
1.25 nightly is ready, it contains the complete fix, and will be 1.25.0 soon.
It would quite helpful if you could deploy and try it (1.25-nightly should be pretty stable now, even if there are any bugs, we can quickly fix them, and you can also safely downgrade to 1.24.x by
UPDATE versionSQL since there is no incompatible change)