Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERL-674: Invalid time value on file:read_file_info/2 causes system shutdown #3733

Closed
OTP-Maintainer opened this issue Jul 18, 2018 · 2 comments
Assignees
Labels
bug Issue is reported as a bug priority:medium team:VM Assigned to OTP team VM
Milestone

Comments

@OTP-Maintainer
Copy link

Original reporter: josevalim
Affected version: OTP-21.0
Fixed in version: OTP-21.0.4
Component: kernel
Migrated from: https://bugs.erlang.org/browse/ERL-674


Current behaviour on Erlang/OTP 21 (note I passed `unix` for time but it should be `posix`):

{code}
$ /Users/jose/.kerl/21.0/bin/erl
Erlang/OTP 21 [erts-10.0] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Eshell V10.0  (abort with ^G)
1> file:read_file_info(".", [{time, unix}]).
=ERROR REPORT==== 18-Jul-2018::13:31:52.979957 ===
** Generic server file_server_2 terminating
** Last message in was {read_file_info,".",[{time,unix}]}
** When Server state == undefined
** Reason for termination ==
** {function_clause,[{prim_file,from_posix_seconds,[1531913448,unix],[]},
                     {prim_file,read_info_1,3,[]},
                     {file_server,handle_call,3,
                                  [{file,"file_server.erl"},{line,149}]},
                     {gen_server,try_handle_call,4,
                                 [{file,"gen_server.erl"},{line,661}]},
                     {gen_server,handle_msg,6,
                                 [{file,"gen_server.erl"},{line,690}]},
                     {proc_lib,init_p_do_apply,3,
                               [{file,"proc_lib.erl"},{line,249}]}]}
** Client <0.79.0> stacktrace
** [{gen,do_call,4,[{file,"gen.erl"},{line,169}]},
    {gen_server,call,3,[{file,"gen_server.erl"},{line,219}]},
    {file,call,2,[{file,"file.erl"},{line,1495}]},
    {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,681}]},
    {shell,exprs,7,[{file,"shell.erl"},{line,686}]},
    {shell,eval_exprs,7,[{file,"shell.erl"},{line,642}]},
    {shell,eval_loop,3,[{file,"shell.erl"},{line,627}]}]

=CRASH REPORT==== 18-Jul-2018::13:31:52.984247 ===
  crasher:
    initial call: file_server:init/1
    pid: <0.56.0>
    registered_name: file_server_2
    exception error: no function clause matching
                     prim_file:from_posix_seconds(1531913448,unix)
      in function  prim_file:read_info_1/3
      in call from file_server:handle_call/3 (file_server.erl, line 149)
      in call from gen_server:try_handle_call/4 (gen_server.erl, line 661)
      in call from gen_server:handle_msg/6 (gen_server.erl, line 690)
    ancestors: [kernel_sup,<0.45.0>]
    message_queue_len: 0
    messages: []
    links: [<0.47.0>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 6772
    stack_size: 27
    reductions: 45503
  neighbours:

=SUPERVISOR REPORT==== 18-Jul-2018::13:31:52.985848 ===
    supervisor: {local,kernel_sup}
    errorContext: child_terminated
    reason: {function_clause,
                [{prim_file,from_posix_seconds,[1531913448,unix],[]},
                 {prim_file,read_info_1,3,[]},
                 {file_server,handle_call,3,
                     [{file,"file_server.erl"},{line,149}]},
                 {gen_server,try_handle_call,4,
                     [{file,"gen_server.erl"},{line,661}]},
                 {gen_server,handle_msg,6,
                     [{file,"gen_server.erl"},{line,690}]},
                 {proc_lib,init_p_do_apply,3,
                     [{file,"proc_lib.erl"},{line,249}]}]}
    offender: [{pid,<0.56.0>},
               {id,file_server_2},
               {mfargs,{file_server,start_link,[]}},
               {restart_type,permanent},
               {shutdown,2000},
               {child_type,worker}]
=SUPERVISOR REPORT==== 18-Jul-2018::13:31:52.986615 ===
    supervisor: {local,kernel_sup}
    errorContext: shutdown
    reason: reached_max_restart_intensity
    offender: [{pid,<0.56.0>},
               {id,file_server_2},
               {mfargs,{file_server,start_link,[]}},
               {restart_type,permanent},
               {shutdown,2000},
               {child_type,worker}]
** exception exit: {{function_clause,
                        [{prim_file,from_posix_seconds,[1531913448,unix],[]},
                         {prim_file,read_info_1,3,[]},
                         {file_server,handle_call,3,
                             [{file,"file_server.erl"},{line,149}]},
                         {gen_server,try_handle_call,4,
                             [{file,"gen_server.erl"},{line,661}]},
                         {gen_server,handle_msg,6,
                             [{file,"gen_server.erl"},{line,690}]},
                         {proc_lib,init_p_do_apply,3,
                             [{file,"proc_lib.erl"},{line,249}]}]},
                    {gen_server,call,
                        [file_server_2,
                         {read_file_info,".",[{time,unix}]},
                         infinity]}}
     in function  gen_server:call/3 (gen_server.erl, line 223)
     in call from file:call/2 (file.erl, line 1495)
2> {"Kernel pid terminated",application_controller,"{application_terminated,kernel,shutdown}"}
Kernel pid terminated (application_controller) ({application_terminated,kernel,shutdown})
{code}

I would expect it to behave as in Erlang/OTP 20:

{code}
$ /Users/jose/.kerl/20.0/bin/erl
Erlang/OTP 20 [erts-9.0] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V9.0  (abort with ^G)
1> file:read_file_info(".", [{time, unix}]).
{error,badarg}
{code}

@OTP-Maintainer
Copy link
Author

john said:

Thanks for your report! It'll be fixed in the next patch for 21.

@OTP-Maintainer
Copy link
Author

john said:

Fixed in 21.0.4, thanks again for your report!

@OTP-Maintainer OTP-Maintainer added bug Issue is reported as a bug team:VM Assigned to OTP team VM priority:medium labels Feb 10, 2021
@OTP-Maintainer OTP-Maintainer added this to the OTP-21.0.4 milestone Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug priority:medium team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

2 participants