The discussion is about the shm_size option in the app.yml file for Docker. Ghan encountered an error when trying to run vacuum analyze due to the default shared memory size of 512 MB. tgxworld suggested passing custom Docker arguments to override the default, but Ghan found that this didn’t work and had to manually edit the launcher script and rebuild the container.
Ghan proposed making shm_size a configurable option in app.yml to persist across updates and rebuilds. tgxworld agreed that this could be useful and asked for sam’s opinion. sam pointed out that the /admin/upgrade interface doesn’t rebuild the container, but Ghan noted that the shm_size option is hardcoded in multiple places in the launcher script.
sam suggested fixing the issue, but noted that it would require complicated bash scripting. neounix provided a temporary workaround by editing the hostconfig.json file directly, but emphasized that a launcher solution would be better. The current solution for increasing shm_size is still unclear, with markersocial noting that it appears to be hardcoded. As sam mentioned, the fix is complicated, but it seems that making shm_size a configurable option in app.yml could be a viable solution.
The relevant thread on Meta Discourse also discusses this issue.
Would it be possible to make the shm_size param an option in app.yml? I ran into this error today when trying to do a vacuum analyze:
ERROR: could not resize shared memory segment
It was trying to increase the shm usage to 1 GB and failed, as it’s only 512 MB out of the box. This param looks to be in the launcher script, but it might be nice to have this as an option (possibly commented out by default) in the .yml file.
This didn’t work when I tried it unfortunately. I think maybe the container needs to be rebuild to increase the size of the shared memory space? I had to change the value in the hard-coded areas in the launcher script and then rebuild the container for it to actually take effect.
This likely wouldn’t persist across updates/rebuilds either - you’d need to be manually changing it every time.
All I did at first was stop the container, then run the launcher start command with that parameter. Then I manually edited the --shm-size params inside the launcher script itself and rebuilt the container. Then it adjusted the value correctly. If you override the param on the command line to rebuild the container, then won’t the change be lost if you perform an update/rebuild through the /admin/upgrade interface? That’s why I thought it might be best to make it a field in app.yml - then it would persist through rebuilds and code updates.
Caveat: Some people have posted that you must make sure that docker service is stopped before you modify hostconfig.json (or the changes will be overwritten). However, I have not actually tested this. Obviously a launcher solution is better