[erlang-questions] Yaws process died when executing read_file

Martin Dimitrov <>
Thu Oct 20 10:46:23 CEST 2011


Thanks Jeff,

Things are very strange :) I ran the following test:

-module(open_file).
-export([run/0]).

run() ->
    open(5000, []).
   
open(0, _Acc) ->
    io:format("DONE~n", []);
open(N, Acc) ->
    case file:open("handler.yaws", [read]) of
        {ok, IoDeveice} ->
            open(N-1, [IoDeveice|Acc]);
        {error, Error} ->
            io:format("ERROR: ~p on run ~p~n", [Error, N])
    end.

I receive different results. Sometimes it reports system_limit on run
980, sometimes on 3980. And even stranger, when calling open_file:run a
second time the limit goes up to 5000:

1> c(open_file).
{ok,open_file}
2> open_file:runn().
ERROR: system_limit in run 3980
ok
3> open_file:runn().
ERROR: system_limit in run 5000
ok

Also, Windows has a very high handle limit, about 16 million, so I doubt
YAWS is reaching it :)

Regards,

Martin


On 10/20/2011 4:24 AM, Jeff Schultz wrote:
> On Wed, Oct 19, 2011 at 03:36:51PM +0300, Martin Dimitrov wrote:
>> Looking through the config options I found max_size_cached_file which
>> has a default value of 8 kb. The yaws file that is being requested is
>> about 15 kb. Changing the option to 20 kb made the file cashed in memory
>> and no errors are returned. But I wonder why erlang cannot open the file
>> for reading.
> Sounds like it's out of file descriptors, or whatever they're called
> in the MS world.  A quick check suggests that I can open a file about
> 1020 times simultaneously on R14B, MS 7.
>
>
>     Jeff Schultz




More information about the erlang-questions mailing list