[erlang-questions] Yaws process died when executing read_file

Martin Dimitrov <>
Wed Oct 19 16:01:13 CEST 2011


YAWS opens the file with file:read_file.

On 10/19/2011 4:57 PM, CGS wrote:
> As far as I know, the only specific limitations in Erlang are related
> to the memory (if you impose this condition) and to the fact that you
> open your file to write as well (if I saw correctly, you opened the
> file as read_write). But, I am no expert in Erlang and maybe someone
> more knowledgeable can confirm or correct me here.
>
> Nevertheless, it's good your problem was solved and I hope someone
> will satisfy your further curiosity (as I am in no position to do that
> due to my own limitation in knowledge on the subject). ;) :)
>
> Cheers,
> CGS
>
>
>
>
> On 10/19/2011 03:44 PM, Martin Dimitrov wrote:
>> Hi,
>>
>> No. The file is needed only by YAWS. But since YAWS doesn't cache it in
>> memory, it tries to open it on every request and at some point the
>> access error is returned. Windows 7 (the operating system we are testing
>> on) has a very high limit of opened handles. Does Erlang have some
>> limitation on this?
>>
>> Martin
>>
>> On 10/19/2011 3:54 PM, CGS wrote:
>>> Hi,
>>>
>>> Well, that's a question I cannot answer (I can only give you wild
>>> guesses), sorry. But if you need the file just with Erlang (not in
>>> YAWS), why don't you use the same mechanism (meaning, passing the
>>> buffer further and not accessing the harddisk all the time)? It seems
>>> reasonable and faster than accessing it over and over from the
>>> harddisk.
>>>
>>> Cheers,
>>> CGS
>>>
>>>
>>>
>>>
>>> On 10/19/2011 02:36 PM, Martin Dimitrov wrote:
>>>> Hello,
>>>>
>>>> Thanks for the reply.
>>>>
>>>> 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.
>>>>
>>>> Thanks again.
>>>>
>>>> Martin
>>>>
>>>>
>>>> On 10/19/2011 2:34 PM, CGS wrote:
>>>>> Hi Martin,
>>>>>
>>>>> I suppose the access permission error is coming more from the number
>>>>> of threads accessing that file and less from OS.
>>>>>
>>>>> Check your yaws.conf and override some default variables, especially
>>>>> max_connections, keepalive_maxusers and process_options variables (or
>>>>> fail_on_bind_err to check if it YAWS or external sources of
>>>>> limitation). For more information look here:
>>>>> http://yaws.hyber.org/yman.yaws?page=yaws.conf.
>>>>>
>>>>> Also, it wouldn't be such a bad idea to monitor your system resources
>>>>> while setting up limits for connections.
>>>>>
>>>>> And the last thing, if you feel your hardware system is not used at
>>>>> its maximum capacity, try running multiple YAWS systems.
>>>>>
>>>>> I hope it will help.
>>>>>
>>>>> Cheers,
>>>>> CGS
>>>>>
>>>>>
>>>>> On 10/19/2011 12:46 PM, Martin Dimitrov wrote:
>>>>>> I do performance testing of our Erlang application with OpenSTA. The
>>>>>> test runs with 300 virtual users. At some point the following errors
>>>>>> start popping up:
>>>>>>
>>>>>> Yaws process died: {{badmatch,{error,eacces}},
>>>>>>                    [{yaws_server,ut_read,1},
>>>>>>                     {yaws_server,deliver_dyn_file,5},
>>>>>>                     {yaws_server,aloop,3},
>>>>>>                     {yaws_server,acceptor0,2},
>>>>>>                     {proc_lib,init_p_do_apply,3}]}
>>>>>>
>>>>>> The call file:read_file(UT#urltype.fullpath) crashes in function
>>>>>> ut_read(UT). I recompiled the module and printed the context. The
>>>>>> error
>>>>>> is eacces and UT holds:
>>>>>>
>>>>>> {urltype,yaws,
>>>>>>                              {file_info,14088,regular,read_write,
>>>>>>                                  {{2011,9,13},{11,51,42}},
>>>>>>                                  {{2011,10,17},{17,59,44}},
>>>>>>                                  {{2011,3,16},{13,18,58}},
>>>>>>                                  33206,1,3,0,0,0,0},
>>>>>>                              "/handler.yaws",
>>>>>>
>>>>>> "c:/Temp/harmony/script/../www/handler.yaws",
>>>>>>                              "/",undefined,undefined,"text/html",
>>>>>>                              "/handler.yaws",undefined}
>>>>>>
>>>>>> The file handler.yaws is the entry point of our app and is called on
>>>>>> every request. When I run the test with 100 or less virtual users I
>>>>>> don't see these errors. So how can it be "Missing permission for
>>>>>> reading
>>>>>> the file, or for searching one of the parent directories" as the
>>>>>> error
>>>>>> is described in the file:read_file documentation?
>>>>>>
>>>>>> Thanks in advance.
>>>>>>
>>>>>> Martin
>>>>>> _______________________________________________
>>>>>> erlang-questions mailing list
>>>>>> 
>>>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>>> _______________________________________________
>>>>> erlang-questions mailing list
>>>>> 
>>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>> _______________________________________________
>>>> erlang-questions mailing list
>>>> 
>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>> _______________________________________________
>>> erlang-questions mailing list
>>> 
>>> http://erlang.org/mailman/listinfo/erlang-questions
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list