Liking Hugo a lot and now migrating my old hand-coded static site.
There is a large tree with thousands of static image and data files but after adding the whole tree in bulk, hugo fails with memory allocation errno 487.
After trimming the tree and then re-adding dirs, it seems that a static tree of 550MB is OK, but 565MB fails. So a slow increment does not seem to be a workaround, looks like a limit to the total tree Running hugo 0.30.2 on Win7, same result on 32bit 4MB RAM and 64bit 16MB RAM.
Thanks for any advice
hugo -D -v server
INFO 2017/10/29 10:38:09 Using config file: D:\hugo\sites\DoPECC-hugo\config.toml
INFO 2017/10/29 10:38:09 using a UnionFS for static directory comprised of:
INFO 2017/10/29 10:38:09 Base: D:\hugo\sites\DoPECC-hugo\themes\bootswatch-BS3\static
INFO 2017/10/29 10:38:09 Overlay: D:\hugo\sites\DoPECC-hugo\static
INFO 2017/10/29 10:38:09 syncing static files to D:\hugo\sites\DoPECC-hugo\
runtime: VirtualAlloc of 1048576 bytes failed with errno=487
fatal error: runtime: cannot map pages in arena address space
I searched for those error messages and I found a lot of discussion around Windows and memory issues with Go. Iād check those. I donāt think this is something Hugo can fix. Maybe there is a newer version of Go you can install on the 64-bit machine?
I have drilled in a bit more: I have a \static folder with just over 1000 files, these are images and pdfs, mostly 1MB approx in size, a few pdfs up to 20MB, nothing bigger.
Hugo processes and server starts fine if Win7 reports 1040 files in the \static tree with size on disk of 412 028 928 bytes (I know Win7 numbers are ) This is on Win7 with 16GB (yes, GB, my oops before)
If I add 23 MB in 1 file, hugo fails with a go memory allocation errno 487. In this case, size on disk reports as 435 523 584. Remove the 23MB file and hugo is happy again. Add 20MB in many small files, hugo fails again.
So, it seems to me that (in this case) asking hugo to process a \static tree that is more than 412 MB hits the virtual memory allocation issue that has been reported with Go on Windows.
So I am wondering:
is this reproducible elsewhere - do all hugo \static trees fail if > the magic size (approx 412 MB)?
is there a workaround? eg I could
remove the content from the static tree
run hugo in non-server mode to generate an uploadable site
patch the uploadable site by adding back the content that I removed in 1)
test this on a separate server.
much less convenient that the hugo live server but seems like it should work.
and/or
If this is reproducible, can hugoās \static processing be adjusted?
Have you done that in Windows? I donāt have that OS available, so I canāt test. If we canāt fix this due to an OS-specific bug, we can establish that as the likely outcome for others searching this error.
I read that and literally palmed my forehead. Shows my level of involvement in Hugo/Go, my ātraditionalā troubleshooting queries are less useful.
So Iām puzzled.
If i run hugo in build mode, all is OK
If i run in server mode it crashes with errno 487 after the "syncing static filesā¦ " message.
I have a few big pdfs in the static tree so I removed these, leaving all files in static < 10MB - no difference. Static tree is now 490 127 360 bytes in 1231 files - so not so big at all.
At this stage looks like I must build manually and test with another server that looks at the /public output. Thatās a shame because the hugo live server was really good!
I canāt think of anything else to try. I guess itās somehow related to the know issues with Go mem allocation on Win, so maybe out of hugoās control
Suggestions appreciated - thanks for the interest and feedback bep. Can supply the offending source if wanted.
I find myself in threads about the Hugo server for some reason, and BjĆørn has explained to me the ways the server is robust for serving live sites, but it is ultimately included for development. Is that still your use case, for development?
If you are using it for development, you might be able to pass parameters that change the baseURL to something that reflects your local file system. I donāt really know how that works in Windows, but it would allow you to navigate your site locally, sans a separate server. Try it out!
I recognize that as a shoddy replacement, but I am also thinking it is a Windows and Go memory thing. But I also asked if you had the most recent version of Go installed, so what do I know?
The default for hugo server is to render to memory. So that flag will typically make it slightly slower (still very fast), but it will help in ālow resource situationsā (i.e. either very big sites or a PC with little memory).