Closed jrasm91 closed 1 year ago
The postinstall script was introduced in the context of https://github.com/tomayac/local-reverse-geocoder/pull/60. I guess the 4GB memory setting was determined experimentally?! @itaisatati may remember. I'm happy to merge PRs that improve upon the status quo.
It looks like it's a specific issue with running node on a 32 bit architecture. Testing in a VM we were able to reproduce an OOM error when using --max-old-space-size=4096
, while the issue went away with --max-old-space-size=4095
.
Looked this up in the docs. Nothing specific to be found. But 32 bit processes can only address up to a max of 4 gigs of memory address space, so this looks like it's to be expected.
Maybe the postinstall script can determine the bitness of the OS and then set the option accordingly? Do you want to investigate what needs to be done?
It's a tricky problem. Personally, I don't believe a library should be controlling the memory requirements of the runtime in a postinstall script. Just sounds like a recipe for disaster. It seems like you could accomplish the same thing by just manually calling node node_modules/local-reverse-geocode/postinstall.js
from your own code/postinstall hook and removing that line from local-reverse-geocoder
s package.json.
I would suggest either:
Hi @tomayac @jrasm91 I used the 4GB value because some configurations caused the process to start swapping (only tested on 64bit systems) Both options would work for me @aminmahrami would it also work for you? (he requested the feature initially)
LMK if you need my assistance with the change
@itaisatati, sorry for the delay, I was OoO.
LMK if you need my assistance with the change
If you want to open a PR that changes it in the desired direction, that'd be appreciated!
Fixed via #69 for now. We can re-open this should folks depend on a non-dirty fix.
Released v0.15.1
that includes this fix. Thank you!
Ever since the postinstall script was addeed, we've been unable to build for arm/v7, which is a 32-bit operating architecture.
https://github.com/immich-app/immich/actions/runs/4526005132/jobs/7970879554?pr=2088
We don't have any of the environment variables set for, or make use of, the postinstall script in anyway, but it is setting available memory to 4GiB, which I believe for some reason is leading to this OOM error.
Do you have any suggestions as to how we can install and use this library for ARMv7 without disabling all npm scripts? Is there a specific reason why you chose to use a postinstall script to add this feature, instead of letting the calling repository manually call
postinstall
if necessary? And, if so, why it is hardcoded to 4GiB instead of the node lts default value?