Cannot request additional shared memory outside shmem_request_hook

I have PostgreSQL 15.3. Then I install pg_stat_monitor. Then when I restart the database, it can’t start with this error:

-- Unit postgresql-15.service has begun starting up.
Jun 20 13:58:12 PostgresqlDB01 postmaster[1864274]: 2023-06-20 13:58:12.997 EEST [1864274] LOG:  pgaudit extension initialized
Jun 20 13:58:13 PostgresqlDB01 postmaster[1864274]: 2023-06-20 13:58:12.998 EEST [1864274] FATAL:  cannot request additional shared memory outside shmem_request_hook
Jun 20 13:58:13 PostgresqlDB01 postmaster[1864274]: 2023-06-20 13:58:12.998 EEST [1864274] LOG:  database system is shut down
Jun 20 13:58:13 PostgresqlDB01 systemd[1]: postgresql-15.service: Main process exited, code=exited, status=1/FAILURE
Jun 20 13:58:13 PostgresqlDB01 systemd[1]: postgresql-15.service: Failed with result 'exit-code'.

what is the solution for this problem ?

Hi,

what is the solution for this problem ?

Ah, this problem crops up from time to time when postgres demands OS resources that are not available. pg_stat_monitor isn’t the only use case that can cause this problem, increasing the maximun number of connections is a common cause of this issue too.

There are two solutions:

  • Not ideal: reduce the number of maximum connections, freeing up kernel resources.
  • Increase kernel resources

Here’s a couple of reference URLs that I hope can help you out:

Hope this helps.

thanks for your information ,
but which parameter kernel should i edit it ?
and max connection for me is default 100