GNU/Linux, Virtualization, Open Source, Oracle Fusion Middleware, Knowledge Management, troubleshooting & performance tuning tips.

Thursday, November 20, 2008

Too Many Open Files on Ubuntu Linux when installing Oracle BPM

Recently I've been working on VM images for test a test environment based on the new Oracle BPM 10gR3 release and the OS has to be Linux for some reason.

Environment
OS: Ubuntu 8.10 Intrepid Ibex 32-bit
Kernel: 2.6.27-7-generic
JDK: Sun JDK 1.6.0_10
Weblogic Server 10gR3 on JRockit 1.6.0_05 (R27.6.0-50 linux ia32)
(I use the Oracle Service Bus 10gR3 install media which includes WLS)
Oracle 10g XE


We can do it even though Ubuntu is not a supported configuration as per the support matrix. Baiscally all Linux distribution is the same, the only thing matters is the administrator;-)
Interoperability Matrix:
http://www.oracle.com/technology/products/bpm/obpm_config_matrix.html

Note: Create a user for WLS and OBPM is recommended. Using root to install is okay but DO remember to change the owner of the destination to the user created to run WLS and OBPM later. DO NOT use root to run WLS and OBPM in production environment for security.

  1. Launch admin center using root, just use su -s to avoid typing sudo all the time. If not we may encounter permission problems.
    /opt/OracleBPMwlHome/bin/./obpmadmcenter

  2. Click configuration, in Directory tab, click add to create directory. I don't want to talk all the details, please refer to the official installation guide for more details:http://download.oracle.com/docs/cd/E13154_01/bpm/docs65/config_guide/index.html

    Normally this is probably a pain free process (actually it was on Windows as I did it a few days ago)

    In this case, the Configuration wizard hang at around 70%, like in the screenshot.

So I checked the WLS logs as well as the Adim Center logs. It seems that errors were encountered when executing WLST. Errors in Admin Center log:

java.io.FileNotFoundException: /opt/bea/user_projects/domains/bpm/config/config.xml (Too many open files)

This is simply due to the default Linux user security limit, by default a user's max open files (per Terminal session) is 1024 on almost all Linux distributions that I am aware of. This default value is the culprit in this case. For WebLogic Server deployment, it is recommended to change the value to at lease 131072 (Oracle Enterprise Linux recommended, changes can be seen by looking into the oracle-validated RPM package).

Session Wide Solution:
Increase the limit of open files using the command ulimit -n 131072 in a Terminal session, start the obpmadmcenter and WLS in the same Terminal session.

Use ulimit -a or ulimit -n to check the new limit. This is just a temporary workaround, you lose the changes once terminal session ends.

Make the change permanent:
Change the file /etc/security/limits.conf (root access required)
Add the following lines, assume user is oracle (the following changes are recomended by Oracle, for Fusion Middleware and Database 10g/11g):

oracle hard nofile 131072
oracle soft nofile 131072
oracle hard nproc 131072
oracle soft nproc 131072
oracle soft core unlimited
oracle hard core unlimited
oracle soft memlock 3500000
oracle hard memlock 3500000
# Recommended stack hard limit 32MB for oracle installations
# oracle hard stack 32768

Start Admin Center, start BPM Web applications, then Weblogic Server. Now you can login to Process Administrator (webconsole) and Workspace and see the sample process if you selected the option.

Alternative workaround(from Official Debian Documentation and Oracle Technology Network):

make the change without rebooting the server box

sysctl -w fs.file-max 65536
sysctl -a
(echo "65536" > /proc/sys/fs/file-max)

To make this change permanent by inserting the kernel parameter in the /etc/sysctl.conf startup file:
# echo "fs.file-max=65536" >> /etc/sysctl.conf

To query the current usage of file handles by using the following:
# cat /proc/sys/fs/file-nr
825 0 65536

Difference between changing the resource limits via ulimit and sysctl:

Basically the priority is: soft limit < style="font-weight: normal;">The Linux kernel provides the getrlimit and setrlimit system calls to get and set resource limits per process. Each resource has an associated soft and hard limit. The soft limit is the value that the kernel enforces for the corresponding resource. The hard limit acts as a ceiling for the soft limit: an unprivileged process may only set its soft limit to a value in the range from 0 up to the hard limit, and (irreversibly) lower its hard limit. A privileged process (one with the CAP_SYS_RESOURCE capability) may make arbitrary changes to either limit value.

Doubt: Why the output from cat /proc/sys/fs/file-nr and lsof | wc -l always different?
Basically, file-nr provides the open File Descriptors (Data Structure, required handle when applications try to open a file) while lsof outputs Open Files including those NOT using File Descriptors (e.g. current working directory, library files mapped into memory, executable text file etc...).

Generally speaking, lsof of a process always > process's open file descriptors

Do a quick test on your system:
Get Firefox's pid

Get number of opened files by Firefox
lsof -p pid | wc -l
Or
lsof | grep pid | wc -l

Check Firefox process's File Descriptors
ls /proc/pid/fd | wc -l

Compare, got it?
Note: Loaded Library files can be checked by digging into /proc/pid/maps

For Oracle Enterprise Linux and Red Hat Enterprise Linux
Install the oracle-validated package which will resolve all Oracle Fusion Middleware and Database required dependencies and system configurations. Simple run yum install oracle-validated or download the rpm and manually install it!

Tips: Install OpenSSH for easy management as a VM. If you prefer Web UI, try webmin it is also a good tool for overall management. I install webmin on each of my Ubuntu Server VM or box.

References:

0 comments:

About Me

Sydney, NSW, Australia
Keep Life Simple and Stupid:)

FriendFeed badge

Tags