bug in inets or erlang!

Micael Karlberg bmk@REDACTED
Tue Nov 29 19:00:13 CET 2005


It's not an unusual call. It does this every time it sends
a reply to a request (if you have the mod_get module). The
thing is that for some reason the file_info record returned
by file:read_file_info(Path) had a strange mdate
(modification date).
I will look into this some more tomorrow.

/BMK

Peter Lund wrote:
> 
>> Micael Karlberg wrote: Hi,
>>
>> The inets web-server get's the (modification) time from the file-info
>> record of the file: file:read_file_info(Path). What does this call
>> give you?
>>
>> /BMK
> 
> 
> 
> Nothing unusual sorry!  I got this:
> 
> (pds@REDACTED)6> file:read_file_info("index.html").
> {ok,{file_info,360,
>               regular,
>               read_write,
>               {{2005,11,29},{12,15,18}},
>               {{2005,10,17},{18,44,2}},
>               {{2005,10,17},{18,44,2}},
>               33188,
>               1,
>               1042,
>               1723200,
>               426909,
>               1001,
>               1001}}
> (pds@REDACTED)7>
> 
> As Mattias said. This may be difficult to reproduce. I don't know what 
> caused inets to make that failing call (except for what I see in the 
> stack trace I posted originally). I have only seen it once and that was 
> after a brute force power down of the FreeBSD system (removal of 
> electrical power) and then turning it on again some 4-5 hours later.
> 
> /Peter
> 
>> Peter Lund wrote:
>>
>>> Yes, the important question here is if:
>>>
>>>  erlang:universaltime_to_localtime({{1969,12,31},{23,59,59}}).
>>>
>>> really should crash the code just because it is 1 sec too early? 
>>> No-one seems to have any opinion about it!
>>>
>>> I am running on R10B (5.4.8). How do you figure out which "R10B-NN" 
>>> it is?
>>>
>>>
>>> Regarding why inets made this call when I tried to surf to "/" on my 
>>> server I do not know. I hoped that some OTP person should fix this. 
>>> The index.html on the DocumentRoot place was not even close to 36 
>>> years old (just a couple of months).
>>>
>>> /Peter
>>>
>>> Matthias Lang wrote:
>>>
>>>> Hi,
>>>>
>>>> I started off by wondering why universaltime_to_localtime() doesn't
>>>> work for the date you gave. The relevant files are
>>>> erts/emulator/beam/bif.c and erts/emulator/beam/erl_time_sup.c. In 
>>>> univ_to_local(), there's a rangecheck on the year. If it's less than
>>>> BASEYEAR, the call fails. BASEYEAR is 1970. Real men don't read
>>>> manuals, but it'd help all the sissies like me if the manual gave a
>>>> clue about that.
>>>>
>>>> The other question is easier to answer---your trace provides all the
>>>> information. inets calls univeraltime_to_localtime/1 with an argument
>>>> from 1969 because the file you tried to get inets to serve has a 
>>>> modification time from 1969. Take a look at the log to see which file
>>>> it was.
>>>>
>>>> Matthias
>>>>
>>>> ----------------------------------------------------------------------
>>>>
>>>> peter writes:
>>>>
>>>> > After my FreeBSD server running erlang was restarted, suddenly
>>>> > INETS was not comming up as it was expected to. In the inets
>>>> > error_log I found:
>>>> > > > more error_log_16111
>>>> > [26/Nov/2005:13:14:42 -0000] reporting error: traverse exit from 
>>>> apply: mod_get:
>>>> > do =>
>>>> > 
>>>> {badarg,[{erlang,universaltime_to_localtime,[{{1969,12,31},{23,59,59}}]}, 
>>>>
>>>> >          {calendar,local_time_to_universal_time_dst,1},
>>>> >          {httpd_util,rfc1123_date,1},
>>>> >          {mod_get,get_modification_date,1},
>>>> >          {mod_get,do_get,1},
>>>> >          {httpd_response,traverse_modules,2},
>>>> >          {httpd_response,generate_and_send_response,1},
>>>> >          {httpd_request_handler,respond,3}]}
>>>> > > > WHY is inets calling erlang:universaltime_to_localtime/1 with  
>>>> [{{1969,12,31},{23,59,59}}] ?? Looks like a potential bugg to me OR 
>>>> should this bug actually be located to the erlang module instead? 
>>>> Should this call really result in a crach?
>>>> > > Anyhow to get inets up and running again I had to patch the 
>>>> calendar.erl module catching for this crash and in that case return 
>>>> {{1970,1,1},{0,0,0}}. > > What need to change here erlang or some 
>>>> module in inets?
>>>> > > /PeterPeter Lund
>>>> > _________________________________________________________
>>>> > Sent using Mail2Forum (http://m2f.sourceforge.net)
>>>>
>>>>  
>>>>
>>>
>>>
>>
> 
> 



More information about the erlang-questions mailing list