-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
after upgrade to 1.13.0+rc2 consumes too much memory #13718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We need logs. We can't even begin to fix an issue like this without some logs. If I had to guess, and that is all I can do without logs, the issue is going to be the generation of repo stats. BUT WE NEED LOGS. Let me just repeat that... We need logs. This is so important that we have added information to the issue template:
|
Thanks for deciding to consider my problem. Log and config: |
This comment has been minimized.
This comment has been minimized.
@kuznetz OK I don't think those logs appear to be very helpful. I think we need some pprof details from the heap. My suspicion is that this is a go-git related issue - I'm not certain why this has suddenly become a big issue from 1.12 to 1.13, perhaps we migrated some more important code to go-git or more people are trying repositories with large files in them. In any case my suspicion is that if you try master right now - you'll find that the situation is much better. |
My gitea container was capped to 256MB and works reliable the last month with an avg of 156MB usage. |
@MorphBonehunter Glad to hear that. But it seems the converting go-git to git command only occurred on master now. |
Mine seems to consistently run out of a 512MB quota:
Right after startup it seems to consume about 200MB:
After pushing one commit in a tiny repository:
Can I do something to reduce ram usage? I'm using 1.13.2. Vanilla Gogs on the same exact repository used (quite literally) ten times less memory. |
@cthu1hoo just like above, this doesn't help us. By saying it uses x amount of RAM we can't do anything about that as we don't know what is going on. We NEED logs, and debugging information to be able to help you. Maybe you have large binary files in your git repo, and go-git (the underlying git library that we are transitioning away from) reads the whole file into memory, but again we do not know what is going on if you don't provide us detailed information. Are there git garbage collect cron jobs going on that you have enabled on binary start? Have you tried the suggestions from above such as testing if the changes upcoming in 1.14.0-dev help? There is so much we do not know if you don't tell us. |
I'll be happy to provide more information, just point me at the document or something describing how to get it.
I have a bunch of fairly old repositories (some started before git was a thing) but there should be nothing particularly large in them.
I'm using Docker setup at mostly default settings, I haven't tweaked anything like that. I've cloned my tt-rss.org production instance (1.13.2) to a 1.13.2:
1.14.0+dev-665-g19fccdc45:
However, even though I can clone and push a few things into repositories, production is under some load from other people, while test instance isn't, which could explain at least some difference in RAM consumption. I don't really follow Gitea development closely, is development version stable enough, or is it broken a lot? If I can rely on |
From your info above it appears that master is better than 1.13 for you by at least 2 times. It looks like you're yet another report of the go-git memory problems. However to as tech says above: We need more logs. In this case, we need pprof data: [server]
ENABLE_PPROF = true The way you use pprof is on the server do: go tool pprof http://localhost:6060/debug/pprof/profile?seconds=60
should give you an SVG map of where memory usage is. More detailed gitea logs can be generated by looking at: https://docs.gitea.io/en-us/logging-configuration/#debugging-problems SQL logs could be obtained using: [database]
LOG_SQL=true
... Additional git logs using: RUN_MODE = dev However the pprof data is what we need. My guess is you will find the mem usage is all in the go-git code. |
This seems to be the CPU profile, am I reading this wrong or is heap profile needed instead? I've noticed one more thing: there seems to be much higher RAM usage when trying to push over HTTP, as opposed to SSH. My Gitea instance is behind Cloudflare so some people do that. Trying to push a large repository over HTTPS on 1.13.2 reliably OOMs and crashes the instance in a few seconds:
I could crash 1.13 instance updating a very small repository over HTTP. The same exact push finishes successfully on 1.14-dev instance with container RAM usage peaking at ~470MB for a short time before going back to ~170MB. I had to bump container RAM limit to ~700MB before I could finish the push on 1.13 in one go. Here's some pprof top reports from 1.13:
One more heap profile right near the end of it when RAM usage was spiking:
I haven't seen "go-git" anywhere but I don't really know what it should look like. If any of those top reports look useful, I can attach the relevant .pprof files here. I can also dump all pprof files I've collected if that would be of any help. I haven't enabled pprof on my test (1.14-dev) instance but on all similar tests it performed much better than 1.13 and never crashed once. So, maybe this really is fixed in master and I just need to wait until next stable version. |
sorry heap is the correct one - I've had to copy and paste that information multiple times so probably copied the wrong one. |
I think top is unfortunately not the most useful thing here - you'd need to actively look into where the memory use is using CPU profile is not helpful here, One thing that will be using more memory is the default to use argon2 for password authentication - change PASSWORD_HASH_ALGO to use a less memory intensive alternative. |
Changing PASSWORD_HASH_ALGO to bcrypt seemingly stopped RAM spikes entirely on large pushes on 1.13 (over HTTPS, SSH is similar). RAM usage tops out at ~430MB and drops afterwards. I could safely lower container memory quota to 512MB without any crashes, so far. Could you explain why would this have such a huge effect while processing received data? HTTP authentication on every request or something? Here's two SVG files generated from heap profile while near top memory usage (after changes to bcrypt) - first during the push being processed, second after it was finished. Web wouldn't work for me (WSL2) but apparently those could be generated directly via Thanks. |
It's extremely secure by default but not great for people who really want low memory. That's probably the cause of most of your memory issues. There's an issue with go-git loading all of the data into memory which is fixed on 1.14/master. The heap looks reasonable from svgs you've sent. (That heap is only ~130Mb not 400Mb.) |
Yeah, I think this needs a very prominent warning because a few concurrent git pushes can starve an instance running on a much more serious hardware than a low memory VPS. The way argon eats memory doesn't look very scalable to me. Anyway, thanks to everyone for help. |
@cthu1hoo why don't you propose a change to the documentation for this. |
I think we have sent a PR on master to change the default PASSWORD_HASH_ALGO to another one? It seems not. |
thats waht #14294 is for ... it's still an ongoing discussion ... :/ |
Since #14675 merged, I think this can be closed. Feel free to reopen it. |
[x]
):Description
After upgrading version from 1.12 (to fix issue #13605), new version takes all avaliable (~1,5GB) memory, and falling docker host.
After limiting to 512MB in docker configuration, gitea reach maximum and not respond to git or web browser.
It allocating memory by 50-10MB, each 1-3 min, until reach maximum.
After 10-15 min after overflow, it looks like the server is restarting and the loop repeats.
Past version consumes ~200mb with similar repos.
Screenshots
The text was updated successfully, but these errors were encountered: