Perl/Solaris Problem with > 256 File Descriptors 
Author Message
 Perl/Solaris Problem with > 256 File Descriptors


Hello all,

<Cross Posted to comp.lang.perl and comp.unix.solaris>


I'm having a problem with opening more than 256 File Descriptors in
Solaris 2.6 through Perl.  This problem does not exist with C++ on
Solaris 2.6 or with Perl on any other platform that I had easy access
to.   (i.e. The soft limit is reachable on other platforms)

Changing the soft limit from 64 to 1024 allowed me to go from 61 to
253, but the Perl script bailed after that.  Below is a stripped down
version of what I'm trying to do as well as output from the various

Is there some other limit that I am reaching?  Any suggestions would
be greatly appreciated.  Please drop me an email if possible, as I
don't know how often I will be able to check back on usenet.


Sean Rolinson


Tested Against:
Sun E4500 Running 2.6
Sun Ultra5 Running 2.6
Linux (Alpha) 2.2.13

All running perl 5.005_03.

********** BEGIN: Simple Perl Script **********
#! /usr/local/bin/perl -w

use strict;
use Socket;

my $cnt = 0;
my $new_skey;

while( 1 ) {
  $new_skey = $cnt;

  no strict 'refs';
  my $skey = \*$new_skey;
  use strict 'refs';

  my $sock = socket( $skey, Socket::PF_INET, Socket::SOCK_STREAM,

   if ( ! $sock ) {
     print "Unable to open socket: $cnt\n";
     sleep( 5 );
    else {


******** END: Simple Perl Script **********

Below is the output received from each system:

*** SUN Ultra5 (and Enterprise 4500) ***

SunOS wintermute 5.6 Generic_105181-16 sun4u sparc SUNW,Ultra-5_10

This is perl, version 5.005_03 built for sun4-solaris



Use of uninitialized value at line 16.
Unable to open socket: 253
Use of uninitialized value at line 16.
Unable to open socket: 253

*** FreeBSD 3.4-RELEASE ***

bash$ uname -a
FreeBSD syrinx 3.4-RELEASE FreeBSD 3.4-RELEASE #8: Sun Mar  5 21:19:35

bash$ perl -v

This is perl, version 5.005_03 built for i386-freebsd

bash$ ulimit -Sn
bash$ perl
Unable to open socket: 2039

*** Linux (alpha) 2.2.13 ***

Linux 2.2.13 #2 Sat Dec 18 22:39:18 EST 1999 alpha

This is perl, version 5.005_03 built for alpha-linux



Use of uninitialized value at line 16.
Unable to open socket: 1021

Sat, 21 Sep 2002 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. System call return value 256 - Bad file descriptor

2. opening more than 256 files in perl on solaris

3. Net::Telnet->cmd + > 256 chars

4. Informix and Perl, char(n) n>256

5. problem with perl cgi scripts adding newlines after 256 characters

6. fork and a file descriptor on solaris

7. {block} orinted <FILE> descriptors

8. Handling return codes over 256

9. DBD:Informix msg:-280: A quoted string exceeds 256 bytes

10. full 256 ascii auto string increment?

11. system call via CGI error 256

12. 256 char limitation?


Powered by phpBB® Forum Software