January 11, 2010

Solaris 10 & syslog-ng file descriptor

Posted in Solaris at 4:55 pm by alessiodini

Recently i worked with file descriptors on Solaris 10.
The problem is originated from syslog-ng that wrote “too many open files” and someone spoke about Solaris problem.

During my analysis i have found:

– on Solaris 10 the default fd are 256 and they can be configured at MAXINT ( the value of this variable depends on system’s architecture , in this case can be two billion ).

– on this system file descriptor are configured as 70.000 ( current and max )

Altough they are configured as 70.000 , syslog-ng was started with only 4096 , as follow:

root@systembo # pgrep -lf syslog-ng
7313 /opt/syslog-ng/sbin/syslog-ng
7312 /opt/syslog-ng/sbin/syslog-ng

root@systembo # pfiles 7313 | head
7313: /opt/syslog-ng/sbin/syslog-ng
Current rlimit: 4096 file descriptors
0: S_IFCHR mode:0666 dev:345,0 ino:6815752 uid:0 gid:3 rdev:13,2
O_RDONLY|O_LARGEFILE
/devices/pseudo/mm@0:null
1: S_IFCHR mode:0666 dev:345,0 ino:6815752 uid:0 gid:3 rdev:13,2
O_WRONLY|O_LARGEFILE
/devices/pseudo/mm@0:null
2: S_IFCHR mode:0666 dev:345,0 ino:6815752 uid:0 gid:3 rdev:13,2
O_WRONLY|O_LARGEFILE

I was really surprised about that and i wrote a script for testing fd use:

root@systembo # cat test.sh
#!/usr/bin/bash

while true;
do
sleep 1;
done

I ran it:

root@blora1bo # ./test.sh &
[1] 28905

root@systembo # pfiles 28905 | head
28905: /usr/bin/bash ./test.sh
Current rlimit: 70000 file descriptors
0: S_IFCHR mode:0620 dev:345,0 ino:12582918 uid:0 gid:7 rdev:24,1
O_RDWR|O_NOCTTY|O_LARGEFILE
/devices/pseudo/pts@0:1
1: S_IFCHR mode:0620 dev:345,0 ino:12582918 uid:0 gid:7 rdev:24,1
O_RDWR|O_NOCTTY|O_LARGEFILE
/devices/pseudo/pts@0:1
2: S_IFCHR mode:0620 dev:345,0 ino:12582918 uid:0 gid:7 rdev:24,1
O_RDWR|O_NOCTTY|O_LARGEFILE

Wow! The scripts is correctly started.
The problem was syslog-ng. I think that somewhere it had a fd configuration.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: