Resolving "Out of Shared Memory" Errors for the Postgres database

Document ID : KB000029715
Last Modified Date : 30/03/2018
Show Technical Document Details
Issue:

Description:

The Postgres APM database is seeing "Out of Shared Memory Errors." What can be done about this?

 

Issue:

Customer has a MOM and an APM Postgres Database on the same server. Shared Memory Errors appear when doing one of two things:

1. Starting the EM and the APM Database is running an update query that consumes most of the EM memory. The query is the following


update ts_us_sessions_map set ts_soft_delete=true, ts_ageout_time='2013-01-21 17:45:00' where ts_soft_delete=false and ts_last_update<'2013-01-21 16:45:00' and ts_app_id=1;

However, the database table involved is empty and executing the following query returns a value of zero:

select count (*) from ts_us_sessions_map;

 

2. Running the query directly on the APM database.


apmdes01:/opt/wily_data/data/bin> PGUSER=admin PGPASSWORD="admin" psql -q -d cemdb
cemdb=> update ts_us_sessions_map set ts_soft_delete=true, ts_ageout_time='2015-01-21 17:45:00' where ts_soft_delete=false and ts_last_update<'2015-01-21 16:45:00' and ts_app_id=1;
WARNING: out of shared memory
ERROR: out of shared memory
HINT: You might need to increase max_locks_per_transaction.
cemdb-> \q

 

 

 

Resolution:
Solution:
Here are some things to investigate should this issue occurs
1. Increase max_locks_per_transaction to at least 200.
2. If on a UNIX system, run the ipcs command to check the Postgres shared memory. A link is below.

http://www.thegeekstuff.com/2010/08/ipcs-command-examples/

3. Increase the APM pool connections (c3p0) as needed
4. See if Session information is needed for the first place. Session map tables can get very large.
5. See the APM Database Maintenance Tech Note for more info.  

https://communities.ca.com/servlet/JiveServlet/downloadBody/117511715-102-2-13530/20140424%20Database%20Maintenance.pdf

6. Following the best practice of placing the APM database on its own server to eliminate memory and connection contention.
7. Make sure there is enough memory on the system.
8. Increasing SWAP temporarily to provide enough virtual memory for the EM to start when the RAM request is issued by the JVM to the kernel.


Also see KB000048296​.