selecttest on Solaris 9

Gary Mills mills at cc.umanitoba.ca
Thu Aug 7 20:43:04 UTC 2008


I posted this information several days ago in response to another
article, but mine never appeared.  These are my trials of selecttest
on Solaris 9, first as an ordinary user...

  $ ./selecttest
  selecttest: nsocks = 4093, TEST_FDSETSIZE = -1, FD_SETSIZE = 1024, sizeof fd_set = 128
  opening 254th socket failed: Too many open files
  <mills at hadar:238>$ ./selecttest -r
  selecttest: nsocks = 4093, TEST_FDSETSIZE = -1, FD_SETSIZE = 1024, sizeof fd_set = 128
  set resource limit: Not owner
  $ ./selecttest 250
  selecttest: nsocks = 4093, TEST_FDSETSIZE = -1, FD_SETSIZE = 1024, sizeof fd_set = 128
  created 250 sockets, maxfd = 252
  FD_CLR test...OK
  FD_SET test...OK
  select test...OK

Now as root...

  # ./selecttest -r
  selecttest: nsocks = 4093, TEST_FDSETSIZE = -1, FD_SETSIZE = 1024, sizeof fd_set = 128
  created 4093 sockets, maxfd = 4095
  FD_CLR test...OK
  FD_SET test...OK
  select: Invalid argument
  select test...
  # ./selecttest -r 1022
  selecttest: nsocks = 4093, TEST_FDSETSIZE = -1, FD_SETSIZE = 1024, sizeof fd_set = 128
  created 1022 sockets, maxfd = 1024
  FD_CLR test...OK
  FD_SET test...OK
  select: Invalid argument
  select test...
  # ./selecttest -r 1020
  selecttest: nsocks = 4093, TEST_FDSETSIZE = -1, FD_SETSIZE = 1024, sizeof fd_set = 128
  created 1020 sockets, maxfd = 1022
  FD_CLR test...OK
  FD_SET test...OK
  select test...OK

This happens because, according to the select() man page...

     EINVAL    The nfds argument is less than 0 or  greater  than
               FD_SETSIZE.

It also includes this...

     The poll(2) function is preferred  over  this  function.  It
     must  be  used  when  the number of file descriptors exceeds
     FD_SETSIZE.

sendmail on Solaris does use poll().

I've now installed bind-9.3.5-P2 on several Solaris 9 servers,
replacing bind-9.3.2-P2.  It doesn't suffer from this problem because
it always sets `files = FD_SETSIZE'.  CPU usage has increased
somewhat.  The number of file descriptors used for sockets is fairly
low.  Here's my test...

    # pfiles 17275 | grep S_IFSOCK | wc -l
          12

-- 
-Gary Mills-    -Unix Support-    -U of M Academic Computing and Networking-


More information about the bind-users mailing list