max ports and max fds

Klacke klacke@REDACTED
Fri Feb 21 12:24:16 CET 2003


The following diff shows an error, or at least a confusion
in io.c. The patch is for R8, but exactly the same code 
remains in R9 except that the variable has been renamed from
erl_max_ports to erts_max_ports + an additional sanity check.


tita:beam> cvs diff io.c
Index: io.c
===================================================================
RCS file: /home/share/erlang/cvsroot/otp/erts/emulator/beam/io.c,v
retrieving revision 1.18
diff -c -b -r1.18 io.c
*** io.c        8 Oct 2002 11:46:15 -0000       1.18
--- io.c        21 Feb 2003 11:02:05 -0000
***************
*** 693,699 ****
      if (maxports != NULL) 
        erl_max_ports = atoi(maxports);
      else
!       erl_max_ports = 0;
  
      last_port = 0;
      if (erl_max_ports < 1024)
--- 693,699 ----
      if (maxports != NULL) 
        erl_max_ports = atoi(maxports);
      else
!       erl_max_ports = sys_max_files();
  
      last_port = 0;
      if (erl_max_ports < 1024)



The problem is that by default max_ports is set to 1024.
There is an environment variable in the code which can be
used to set max ports

as:

# export ERL_MAX_PORTS=2048

The problem with that is that, it's not intuitive.
If I do:

# uname -n 2048
# erl

I expect the erlang system to be able to open 2048 files, 
it doesn't unless I also set the ERL_MAX_PORTS=2048.

The correct default value in my opinion is max_files

So otp: 
   accept, reject, delay, ignore, or rework this patch ?


/klacke


-- 
Claes Wikstrom                        -- Caps lock is nowhere and
Alteon WebSystems                     -- everything is under control          
http://www.bluetail.com/~klacke      
cellphone: +46 70 2097763



More information about the erlang-questions mailing list