Setup fails: Cannot allocate memory

Hi,

I’m new to discourse and tried to install it the very fist time. The first try even did not create the database and second after (deleting everything and starting from scratch) is again complaining:

2022-08-04 18:51:53.698 UTC [41] FATAL:  could not map anonymous shared memory: Cannot allocate memory
2022-08-04 18:51:53.698 UTC [41] HINT:  This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 1125310464 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.

There is another error before (don’t know if relevant):

I, [2022-08-04T18:51:52.606862 #1]  INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
2022/08/04 18:51:52 socat[18] E connect(6, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): No such file or directory

The machine is a virtual server (don’t know which technology) with 4 GB RAM and 138 GB free space.

Could find any suitable hint here. Hence, any idea how to fix?

TIA
Roland

1 Like

Is this the only thing running within the VM?

What’s the result of cat /proc/meminfo | grep MemFree ?

Did you follow the Standard Install and run discourse-setup? It should tune the memory settings for the spec of the VM assuming it meets the minimum requirements.

What are db_shared_buffers, unicorn_workers and db_work_mem in your app.yml?

1 Like

Yes (except one small perl script).

MemFree: 758840 kB

But more than 3 GB is for cache.

The latter without any changes.

db_shared_buffers: "1024MB"
no entry for unicorn_workers
#db_work_mem: "40MB"
1 Like

If have changed db_shared_buffers to 512 MB and have rebuild the app:

./launcher rebuild app

That looks much better now.

1 Like