-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
hugo stalls when hitting hard memory limit #12129
Comments
I suspect this is a deadlock with the cache mutex (or something), which isn't the easiest thing in the world to debug, but I guess I should be able to trigger this. I have tested this pretty heavily using 1GB limit on some very big sites, but I guess the devil is in the detail. A temporary workaround, I guess, would be to set the memorylimit to something very high. |
I have pushed 564bae0 -- which I don't think will fix your problem. I have spent some time building some pretty beefy sites with Note that I don't doubt that this is a real issue that needs to be fixed, but I need to look closer to reproduce it. I notice from the log that the amount of memory you allocate is on a complete different level than the sites I'm testing on. Can you elaborate a little what all the memory is used for? Image processing? Do you have a image cache? |
It is really hard for me to determine what hugo uses memory for. Yes, we have 2,5 thousands of images, we have around 12 thousands of pages (multiplied by 10 translations). Most of images have previews generated, many of them are additionally resized and dumped as both jpeg and webp, base language build generates 25 thousands images.
Do you mean |
It does not, hugo still stalls on master. |
We start seeing stalls in our cloud builds (we have hugo 0.123.2 there at this point). We have the same memory limits we had for 122, that is HUGO_MEMORYLIMIT is 22. Hugo during the build do not exceed 11Gb. But we see random unpredictable stalls. I can't reproduce anything like this on my machine, but we have this problem in cloud. Example build:
And here it stalled, even though there were no INFO messages with dynacache GC runs. So, it seems that stalls are happening not only in extreme memory conditions, but randomly anytime GC is run. |
So, it's most likely a mutex deadlock, but it's not to me inspecting the code, and I need to reproduce it to understand and fix it. But I will try to spend some time on this today. |
@TiGR what would be useful is, if you could do a |
OK, I think I have reproduced this building a beefy Hugo site on a Ubuntu VM with only 1GB of memory (the memory limit set to 256 MB). I will start by making it possible to set |
Strike that, it actually completed, just took very long (because of image processing, I guess, faster second run with the cache). |
Another reliable way to reproduce stalls is by building big website with HUGO_NUMWORKERMUPTIPLIER=32 |
|
The issue is still there in hugo v0.124. |
@TiGR sorry, I have been a little busy with other things. I see the deadlock in your stack trace and even if I don't have a failing test for it, the fix looks obvious, so I'm going to apply a fix for that later today. I'm boldly closing this issue from that PR, but if it is still a problem, please shout. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Not sure how to reproduce it, maybe by reducing HUGO_MEMORYLIMIT and taking some huge website to test. In case of our huge website we can normally run hugo build with 8Gb memory limit, but if I run hugo server on the same limit, hugo hits the limit at some point and then all cpu usage drops to 0% and hugo just sits there, without doing a thing (no new files are created too).
Running
hugo server --logLevel info
And here it just hangs. I'd expect it to fail somehow if it has run out of memory.
Also, if I reduce the limit, regular hugo build also stalls:
And here it stalled.
The text was updated successfully, but these errors were encountered: