IBM Support

Various DB2 failures may occur on Linux with Address Space Layout Randomization (ASLR)



ASLR or Address Space Layout Randomization is a feature that is activated by default on some of the newer linux distributions. It is designed to load shared memory objects in random addresses. In DB2, multiple processes map a shared memory object at the same address across the processes. It was found that DB2 cannot guarantee the availability of address for the shared memory object when ASLR is turned on. Important note: DB2 10.1 has been enhanced so that ASLR can be safely enabled. However, tools and processes that are run outside of the db2sysc process may still fail to start.


This conflict in the address space means that a process trying to attach a shared memory object to a specific address may not be able to do so, resulting in a failure in shmat subroutine. However, on subsequent retry (using a new process) the shared memory attachment may work. The result is a random set of failures. Some processes that have been known to see this error are: db2pd, db2egcf, and db2vend.

Some of the behaviors seen include the following:

For the db2pd command, it will print the following message:
Exceeded re-exec max count trying to attach to the database manager.
This is likely due to ASLR currently being enabled on this system.
Please retry the db2pd command.

For the db2egcf process, used for HA monitoring, the db2egcf may incorrectly determine the instance is down and initiate a failover.

For the db2vend process, backup and log archive methods might fail with an error indicating a child process could not be started:
SQL2043N  Unable to start a child process or thread.  

Diagnosing The Problem

When this problem is suspected, check db2diag.log for the shmat failure like the following. Note that the same error message can also occur for a different cause. Hence, it's important to note the process that reported this error.

FUNCTION: DB2 UDB, SQO Memory Management, sqlocshr, probe:180
MESSAGE : ZRC=0x850F0005=-2062614523=SQLO_NOSEG
          "No Storage Available for allocation"
          DIA8305C Memory allocation failure occurred.
CALLED  : OS, -, shmat                    OSERR: EINVAL (22)

Resolving The Problem

Retrying the command will create a new process which may be able to attach to the shared memory. However, this may still fail to attach.
The best resolution is to disable ASLR using one of the following methods:
1) Disable ASLR temporarily (change is only effective until next boot):

Run "sysctl -w kernel.randomize_va_space=0" as root.

2) Disable ASLR immediately and on all subsequent reboots:

Add the following line to /etc/sysctl.conf:
and then run "sysctl -p" as root to make the change take effect immediately.

Note that you may find more information about sysctl -p at:

For further discussion on this topic, visit this developerWorks forum thread:

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSEPGG","label":"DB2 for Linux- UNIX and Windows"},"Component":"Operating System \/ Hardware - Other OS\/Hardware","Platform":[{"code":"PF016","label":"Linux"}],"Version":"11.5;11.1;10.5;10.1;9.7;9.5","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
19 July 2019