msantos/gen_icmp

:gen__icmp.ping crashes on CentOS 7

Closed this issue · 4 comments

I'm using :gen_icmp.ping in an Elixir project.

The code works fine when I run it via mix on my laptop, but when I make a release with distillery and run the same code on CentOS7, the line:

:gen_icmp.ping(addr)

crashes the process without any message.

I'm building the release inside a docker centos7 container. But later trying to run it on a physical CentOS 7 server.

The actual error message is

{:undef, [{:pkt, :icmp, [{:icmp, 8, 0, 0, 43092, 0, {127, 0, 0, 1}, <<0, 0, 0, 0>>, 0, 0, 0, 0, 0}], []}, {:gen_icmp, :packet, 2, [file: '...gen_icmp/src/gen_icmp.erl', line: 355]}, {:gen_icmp, :"-ping/3-fun-3-", 6, [file: 'gen_icmp/src/gen_icmp.erl', line: 195]}]}

Looks like the pkt library can't be found. Check if it is being included in the release.

I added :pkt to extra_applications in mix.exs and looks like it is now included in the release (lib/pkt-0.4.4/)

I'm getting an error much sooner my release is crashing at the very beginning with this error:

2018-11-30 01:34:15.525244 crash_report        #{label=>{proc_lib,crash},report=>[[{initial_call,{supervisor,kernel,['Argument__1']}},{pid,<0.1306.0>},{registered_name,[]},{error_info,{exit,{on_load_function_failed,procket},[{init,run_on_load_handlers,0,[]},{kernel,init,1,[{file,"kernel.erl"},{line,212}]},{supervisor,init,1,[{file,"supervisor.erl"},{line,295}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,374}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,342}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}},{ancestors,[kernel_sup,<0.1281.0>]},{message_queue_len,0},{messages,[]},{links,[<0.1283.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,376},{stack_size,27},{reductions,273}],[]]}
2018-11-30 01:34:15.525299 supervisor_report   #{label=>{supervisor,start_error},report=>[{supervisor,{local,kernel_sup}},{errorContext,start_error},{reason,{on_load_function_failed,procket}},{offender,[{pid,undefined},{id,kernel_safe_sup},{mfargs,{supervisor,start_link,[{local,kernel_safe_sup},kernel,safe]}},{restart_type,permanent},{shutdown,infinity},{child_type,supervisor}]}]}
2018-11-30 01:34:16.531756 crash_report        #{label=>{proc_lib,crash},report=>[[{initial_call,{application_master,init,['Argument__1','Argument__2','Argument__3','Argument__4']}},{pid,<0.1280.0>},{registered_name,[]},{error_info,{exit,{{shutdown,{failed_to_start_child,kernel_safe_sup,{on_load_function_failed,procket}}},{kernel,start,[normal,[]]}},[{application_master,init,4,[{file,"application_master.erl"},{line,138}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}},{ancestors,[<0.1279.0>]},{message_queue_len,1},{messages,[{'EXIT',<0.1281.0>,normal}]},{links,[<0.1279.0>,<0.1277.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,610},{stack_size,27},{reductions,193}],[]]}
2018-11-30 01:34:16.532733 std_info            #{label=>{application_controller,exit},report=>[{application,kernel},{exited,{{shutdown,{failed_to_start_child,kernel_safe_sup,{on_load_function_failed,procket}}},{kernel,start,[normal,[]]}}},{type,permanent}]}
{"Kernel pid terminated",application_controller,"{application_start_failure,kernel,{{shutdown,{failed_to_start_child,kernel_safe_sup,{on_load_function_failed,procket}}},{kernel,start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,kernel,{{shutdown,{failed_to_start_child,kernel_safe_sup,{on_load_function_failed,procket}}},{kernel,start,[normal,[]]}}})

Crash dump is being written to: erl_crash.dump...done

I changed the version of :gen_icmp from tag: 0.5.3 to the latest version and the error above went away.

Thanks a lot @msantos