On : 11.2.0.4 version, Clusterware, when attempting to connect to database via listener, the following error occurs:
ERROR ----------------------- ERROR: ORA-12518: TNS:listener could not hand off client connection 15-AUG-2017 01:40:01 * (CONNECT_DATA=(CID=(PROGRAM=myapp)(HOST=__jdbc__)(USER=admin))(SERVER=DEDICATED)(SERVICE_NAME=oracle)) * (ADDRESS=(PROTOCOL=tcp)(HOST=11.22.33.44)(PORT=1521)) * establish * oracle * 12518 TNS-12518: TNS:listener could not hand off client connection TNS-12536: TNS:operation would block TNS-12560: TNS:protocol adapter error TNS-00506: Operation would block Linux Error: 11: Resource temporarily unavailable
The issue can be reproduced at will with the following steps:
$ sqlplus user/password@11.22.33.44:1521/oracle
The Solution
In Linux 6 or earlier version, you may need to check ‘max user processes’ etc. with ‘ulimit -a‘ command. But from Linux 7, there are something more need to be check:
DefaultTasksMax was default value(512).
systemd limited maximum number of tasks that may be created in the unit. This setting also effect maxpid value on OS. We observed some ‘fork rejected by pids controller’ error in OS log.
2017-08-16T02:36:55.560027+08:00 server-0 kernel: [ 165.619978] cgroup: fork rejected by pids controller in /system.slice/ohasd.service
which indicates some fork issue due to pid limits. Listener cannot fork more process when the limits is reached, hence TNS-12518 was raised. To resolve the issue edit /etc/systemd/system.conf and set DefaultTasksMax to ‘infinity’.
# vi /etc/systemd/system.conf DefaultTasksMax=infinity