[erlang-questions] {error, emfile} on windows

Kenneth Lundin kenneth.lundin@REDACTED
Tue Nov 30 15:08:33 CET 2010


On Windows there is no limit to set in the shell like in UNIX/Linux
that the Erlang VM
can read and adjust according to.
Therefore you can use the environment variable ERL_MAX_PORTS to set a
higher limit
thant the default (1024). But bevare that the number you set will
imply an allocation
of  memory to hold all these port data structures. So don't set a
higher value than you really need.
You can actually set this on the command line when you start erlang,
like this example:
erl -env ERL_MAX_PORTS 4096

See the documentation at:
http://www.erlang.org/doc/efficiency_guide/advanced.html#id64904
(I admit that it is not easy to find this, but the Efficiency Guide is
important to know
about and to read through for all system builders)

We are thinking of changing this to a totally dynamic number of ports
only limited by the OS setup, but that work is not scheduled for a
specific release yet.


On Tue, Nov 30, 2010 at 12:20 PM, Matthew Sackman <matthew@REDACTED> wrote:
> On Mon, Nov 29, 2010 at 11:18:21PM -0500, Kaiduan Xie wrote:
>> I tried to create 1K TCP/TLS client connections on a Windows box, and
>> got {error, emfile} error, any idea to solve it? I have no problem on
>> Linux after raising the ulimit.
>
> Whilst in theory windows has a limit of around 16M fds per process, the
> Erlang windows port seems to use bits of the MS C runtime. This seems to
> limit severely wrt number of available sockets.

Well this is not a correct statement as already described.
>
> Whilst erlang:system_info(check_io) reports 2048 under Windows, that's
> clearly wrong. But hey, a few years ago, I found that fsync under the
> Windows port was implemented as "return 1;". Such is the quality of the
> Windows port.
This is not the case now, fsync is definitely implemented.

Windows has not been our main target platform for Erlang but I still
think the quality is good even on Windows.

With an increasing number of developers doing serious applications
with Erlang on
Windows the functionality and quality will become even better.


/Kenneth Erlang/OTP, Ericsson

>
> Matthew
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>


More information about the erlang-questions mailing list