Ask A Question



Unexpected error caught in rebar_core when setting logdir

Hi, I added this to my rebar.config as I only wanted the current run and I wanted them in the project root folder to make it easier to .gitignore and also make them visible to me: ``` {ct_opts, [{keep_logs, 1} ,{logdir, "./ct_logs"}] }. ``` When I run with `rebar3 ct` I get this error, ===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump and taking that advice I get a stack trace (at end) which seems to indicate that the "last" folder, a symlink, couldn't be found. If I "rm -fr" the _build folder the problem goes away for one build but then comes back, it's almost as though there is a hardcoded location still looking in the default location for that symlink. Have I done something (probably) wrong in my configuration ? Thanks, Sean. === ``` ===> Uncaught error: {badmatch,{error,enoent}} ===> Stack trace to the error location: [{rebar_prv_common_test,symlink_to_last_ct_logs,1, [{file,"/home/sean/Documents/erlang/rebar3/src/rebar_prv_common_test.erl"}, {line,128}]}, {rebar_prv_common_test,do,2, [{file,"/home/sean/Documents/erlang/rebar3/src/rebar_prv_common_test.erl"}, {line,77}]}, {rebar_core,do,2, [{file,"/home/sean/Documents/erlang/rebar3/src/rebar_core.erl"}, {line,154}]}, {rebar3,run_aux,2, [{file,"/home/sean/Documents/erlang/rebar3/src/rebar3.erl"}, {line,181}]}, {rebar3,main,1, [{file,"/home/sean/Documents/erlang/rebar3/src/rebar3.erl"}, {line,66}]}, {init,start_em,1,[]}, {init,do_boot,3,[]}] ```

Posted by Sean Charles 13 days ago


rebar3, supervisor, behaviour(application)

Hi All, I have the following straightforward UDP Server: - ONLY accept Data <<0:32>>, - otherwise it crash -module(server). -export([listen/1]). listen(Port) -> spawn(fun()->run_it(Port) end). run_it(Port) -> {ok, Skt} = gen_udp:open(Port, [binary]), loop(Skt). loop(Skt) -> receive {udp, Skt, _, _, Bin} -> case Bin of <<0:32>> -> io:fwrite("~p~n", [{"Good Format: ", Bin}]), loop(Skt) end end. Now, Client is going to send a malformed data. I can write a case clause to match any message and simply ignore any malformed message. However, that would be a catch-all-clause, which will not help me if there is eventual bugs. I have read somewhere: "Don't program defensively, let it crash, then fix it". =ERROR REPORT==== 19-Jul-2020::21:15:29.872000 === Error in process <0.93.0> with exit value: {{case_clause,<<0>>},[{ggsn,loop,1,[{file,"ggsn.erl"},{line,16}]}]} Cool, it crash, But I want my server to restart automatically anyway :-) I have read also that a process called "supervisor" can monitor my server and restarts it when it detects that it died. So, I DISCOVERED "rebar3" because it helped me a lot when I compile several files with just 1 single line 'rebar3 compile'. It creates automatically a /src/ with 3 files, but only 2 are interesting me for now: - server_app.erl - server_sup.erl Ok, I have read the documentations but I'm still far from understanding. Can anyone advise please, or transform my 19 lines of code server.erl to server_app.erl and supervised by a server_sup.erl using rebar3? Thanks in advance, Best Regards,

Posted by Lova 19 days ago


Crash when using distributed Erlang with a prod release

Hello, I am trying to let an Erlang node communicate with an Elixir node. Communication works well with a release in dev mode as well as when doing manual testing. But when I make a prod release (rebar3 as prod release) which I start with `_build/prod/rel/myapp/bin/myapp console`, it sends one successful message to the remote Elixir process, hangs a few seconds and then crashes the whole VM. Part of the error message I get in the logs is : `label=&#123;error_logger,error_msg&#125; format="Fatal: ~p was not allowed to send &#123;nodeup, ~p&#125; to kernel when ~s~n" args="[<0.584.0>,'[email protected]',\"initiating connection\"]"`. I have changed the name for confidentiality. And then some more : `&#123;error_info,&#123;exit,&#123;bad_return_value,&#123;'EXIT',&#123;undef,[&#123;erts_internal,abort_pending_connection,[...],...&#125;,&#123;net_kernel,pending_nodedown,...&#125;,&#123;...`. My `config/vm.args` contains the name and cookie. My `rebar.config`is: &#123;relx, [ &#123;release, &#123;myapp, "1.4"&#125;, [myapp, sasl]&#125;, &#123;sys_config, "./config/sys.config"&#125;, &#123;vm_args, "./config/vm.args"&#125;, &#123;dev_mode, true&#125;, &#123;include_erts, false&#125;, &#123;extended_start_script, true&#125; ] &#125;. &#123;profiles, [ &#123;prod, [ &#123;relx, [ &#123;dev_mode, false&#125;, &#123;include_erts, true&#125;, &#123;include_src, false&#125; % &#123;include_erts, false&#125;, % &#123;system_libs, false&#125;, ]&#125; ]&#125; ]&#125;. At ``, in function `mark_nodeup` we can see the error message produced but that didn't help me solve the problem. Do you have an idea of how I have to configure the prod release to make it work ? Version : rebar 3.13.0+build.4520.reff957b5a8 on Erlang/OTP 22 Erts 10.6. TIA PS : Sorry for the spurious HTML character references disseminated inside the code.

Posted by Ludovic Kuty 5 months ago