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

Was setting up project by tutorial and have got error. #686

Open
AlexanderKai opened this issue Feb 26, 2019 · 7 comments
Open

Was setting up project by tutorial and have got error. #686

AlexanderKai opened this issue Feb 26, 2019 · 7 comments

Comments

@AlexanderKai
Copy link

AlexanderKai commented Feb 26, 2019

Erlang (esl) 21.2.6
CentOS 7

How to reproduce:

git clone https://github.com/ChicagoBoss/ChicagoBoss.git
cd ChicagoBoss
make
make app PROJECT=test_project
cd ../test_project
./init-dev.sh
wget localhost:8001

After this I've got:

=CRASH REPORT==== 26-Feb-2019::16:42:44.890633 ===                                                                                     
  crasher:
    initial call: cowboy_stream_h:request_process/3
    pid: <0.244.0>
    registered_name: []
    exception exit: {"Error building response",
                     [{boss_simple_bridge_handler,run,1,
                          [{file,"src/boss/boss_simple_bridge_handler.erl"},
                           {line,30}]},
                      {cowboy_simple_bridge_anchor,init,2,
                          [{file,
                               "src/cowboy_bridge_modules/cowboy_simple_bridge_anchor.erl"},
                           {line,36}]},
                      {cowboy_handler,execute,2,
                          [{file,"src/cowboy_handler.erl"},{line,41}]},
                      {cowboy_stream_h,execute,3,
                          [{file,"src/cowboy_stream_h.erl"},{line,296}]},
                      {cowboy_stream_h,request_process,3,
                          [{file,"src/cowboy_stream_h.erl"},{line,274}]},
                      {proc_lib,init_p_do_apply,3,
                          [{file,"proc_lib.erl"},{line,249}]}]}
      in function  boss_simple_bridge_handler:run/1 (src/boss/boss_simple_bridge_handler.erl, line 30)
      in call from cowboy_simple_bridge_anchor:init/2 (src/cowboy_bridge_modules/cowboy_simple_bridge_anchor.erl, line 36)
      in call from cowboy_handler:execute/2 (src/cowboy_handler.erl, line 41)
      in call from cowboy_stream_h:execute/3 (src/cowboy_stream_h.erl, line 296)
      in call from cowboy_stream_h:request_process/3 (src/cowboy_stream_h.erl, line 274)
    ancestors: [<0.243.0>,<0.223.0>,<0.222.0>,ranch_sup,<0.214.0>]
    message_queue_len: 0
    messages: []
    links: [<0.243.0>]
    dictionary: [{{cowboy_bridge,#Ref<0.2983488407.321650689.101063>},
                   {request_cache,#{bindings => #{},body_length => 0,
                                    cert => undefined,has_body => false,
                                    headers =>
                                        #{<<"accept">> => <<"*/*">>,
                                          <<"connection">> => <<"Keep-Alive">>,
                                          <<"host">> => <<"localhost:8001">>,
                                          <<"user-agent">> =>
                                              <<"Wget/1.14 (linux-gnu)">>},
                                    host => <<"localhost">>,
                                    host_info => undefined,
                                    method => <<"GET">>,path => <<"/">>,
                                    path_info => undefined,
                                    peer => {{127,0,0,1},32476},
                                    pid => <0.243.0>,port => 8001,qs => <<>>,
                                    ref => http,scheme => <<"http">>,
                                    sock => {{127,0,0,1},8001},
                                    streamid => 1,version => 'HTTP/1.1'},
                                  "./priv/static",<<>>}}]
    trap_exit: false
    status: running
    heap_size: 4185                                                                                                                     
    stack_size: 27
    reductions: 7126
  neighbours:

=ERROR REPORT==== 26-Feb-2019::16:42:44.903039 ===
Ranch listener http, connection process <0.243.0>, stream 1 had its request process <0.244.0> exit with reason "Error building response" and stac
ktrace [{boss_simple_bridge_handler,run,1,[{file,"src/boss/boss_simple_bridge_handler.erl"},{line,30}]},{cowboy_simple_bridge_anchor,init,2,[{fil
e,"src/cowboy_bridge_modules/cowboy_simple_bridge_anchor.erl"},{line,36}]},{cowboy_handler,execute,2,[{file,"src/cowboy_handler.erl"},{line,41}]}
,{cowboy_stream_h,execute,3,[{file,"src/cowboy_stream_h.erl"},{line,296}]},{cowboy_stream_h,request_process,3,[{file,"src/cowboy_stream_h.erl"},{
line,274}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]

=ERROR REPORT==== 26-Feb-2019::16:42:44.903388 ===
** gen_event handler error_logger_lager_h crashed.
** Was installed in error_logger
** Last event was: {error,<0.213.0>,
                       {<0.243.0>,
                        "Ranch listener ~p, connection process ~p, stream ~p had its request process ~p exit with reason ~999999p and stacktrace
~999999p~n",
                        [http,<0.243.0>,1,<0.244.0>,"Error building response",
                         [{boss_simple_bridge_handler,run,1,
                              [{file,
                                   "src/boss/boss_simple_bridge_handler.erl"},
                               {line,30}]},
                          {cowboy_simple_bridge_anchor,init,2,
                              [{file,
                                   "src/cowboy_bridge_modules/cowboy_simple_bridge_anchor.erl"},
                               {line,36}]},
                          {cowboy_handler,execute,2,
                              [{file,"src/cowboy_handler.erl"},{line,41}]},
                          {cowboy_stream_h,execute,3,
                              [{file,"src/cowboy_stream_h.erl"},{line,296}]},
                          {cowboy_stream_h,request_process,3,
                              [{file,"src/cowboy_stream_h.erl"},{line,274}]},
                          {proc_lib,init_p_do_apply,3,
                              [{file,"proc_lib.erl"},{line,249}]}]]}}
** When handler state == {state,lager_event,
                             {lager_shaper,error_logger_lager_h,50,1,
                                 {1551,188564,891062},
                                 0,true,0,#Ref<0.2983488407.321650689.95449>,
                                 #Fun<error_logger_lager_h.2.110548065>},
                             handle,false}
** Reason == {{case_clause,
                  [http,<0.243.0>,1,<0.244.0>,"Error building response",
                   [{boss_simple_bridge_handler,run,1,
                        [{file,"src/boss/boss_simple_bridge_handler.erl"},
                         {line,30}]},
                    {cowboy_simple_bridge_anchor,init,2,
                        [{file,
                             "src/cowboy_bridge_modules/cowboy_simple_bridge_anchor.erl"},
                         {line,36}]},
                    {cowboy_handler,execute,2,                                                                                          
                        [{file,"src/cowboy_handler.erl"},{line,41}]},
                    {cowboy_stream_h,execute,3,
                        [{file,"src/cowboy_stream_h.erl"},{line,296}]},
                    {cowboy_stream_h,request_process,3,
                        [{file,"src/cowboy_stream_h.erl"},{line,274}]},
                    {proc_lib,init_p_do_apply,3,
                        [{file,"proc_lib.erl"},{line,249}]}]]},
              [{error_logger_lager_h,log_event,2,
                   [{file,"src/error_logger_lager_h.erl"},{line,246}]},
               {gen_event,server_update,4,[{file,"gen_event.erl"},{line,577}]},
               {gen_event,server_notify,4,[{file,"gen_event.erl"},{line,559}]},
               {gen_event,handle_msg,6,[{file,"gen_event.erl"},{line,300}]},
               {proc_lib,init_p_do_apply,3,
                   [{file,"proc_lib.erl"},{line,249}]}]}

16:42:44.890 [error] error:badarg: [{erlang,apply,[{sbw,cowboy_simple_bridge,{cowboy_bridge,#Ref<0.2983488407.321650689.101063>},false,[],[],[],n
one,#{<<"accept">> => <<"*/*">>,<<"connection">> => <<"Keep-Alive">>,<<"host">> => <<"localhost:8001">>,<<"user-agent">> => <<"Wget/1.14 (linux-g
nu)">>},[],{response,200,[],[],[]}},path,[]],[]},{boss_web_controller_handle_request,handle_request,2,[{file,"src/boss/boss_web_controller_handle
_request.erl"},{line,28}]},{boss_simple_bridge_handler,run,1,[{file,"src/boss/boss_simple_bridge_handler.erl"},{line,26}]},{cowboy_simple_bridge_
anchor,init,2,[{file,"src/cowboy_bridge_modules/cowboy_simple_bridge_anchor.erl"},{line,36}]},{cowboy_handler,execute,2,[{file,"src/cowboy_handle
r.erl"},{line,41}]},{cowboy_stream_h,execute,3,[{file,"src/cowboy_stream_h.erl"},{line,296}]},{cowboy_stream_h,request_process,3,[{file,"src/cowb
oy_stream_h.erl"},{line,274}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]
16:42:44.891 [error] CRASH REPORT Process <0.244.0> with 0 neighbours exited with reason: "Error building response" in boss_simple_bridge_handler
:run/1 line 30 in boss_simple_bridge_handler:run/1 line 30
16:42:44.905 [error] Lager event handler error_logger_lager_h exited with reason {'EXIT',{{case_clause,[http,<0.243.0>,1,<0.244.0>,"Error buildin
g response",[{boss_simple_bridge_handler,run,1,[{file,"src/boss/boss_simple_bridge_handler.erl"},{line,30}]},{cowboy_simple_bridge_anchor,init,2,
[{file,"src/cowboy_bridge_modules/cowboy_simple_bridge_anchor.erl"},{line,36}]},{cowboy_handler,execute,2,[{file,"src/cowboy_handler.erl"},{line,
41}]},{cowboy_stream_h,execute,3,[{file,"src/cowboy_stream_h.erl"},{line,296}]},{cowboy_stream_h,request_process,3,[{file,"src/cowboy_stream..."}
,...]},...]]},...}}

@NoobsEnslaver
Copy link

NoobsEnslaver commented Mar 16, 2019

Same problem. Have error only with erlang-21, with erlang-20 all ok. Make little research, add trace lines into boss_web_controller_handle_request:handle_request this way:

-define(TRACE(X), io:format("~p:~p:~p~n", [?MODULE, ?LINE, X])).

handle_request(Bridge, RouterAdapter) ->
    ?TRACE({"Bridge", Bridge}),
    LoadedApplications = boss_web:get_all_applications(),
    ?TRACE({"LoadedApplications", LoadedApplications}),
    FullUrl = Bridge:path(),
    ?TRACE({"FullUrl", FullUrl}),
    ApplicationForPath = RouterAdapter:find_application_for_path(Bridge,
                                                                  FullUrl,
                                                                  LoadedApplications),
    ?TRACE({"ApplicationForPath", ApplicationForPath}),
    try
       handle_application(Bridge, FullUrl, ApplicationForPath, RouterAdapter)
    catch Class:Error ->
        %% Nuclear option: Something very serious happened and we don't want to
        %% fail silently, but instead it should generate an error message.
        _ = lager:error("Unhandled Error: ~s", [boss_log_util:stacktrace(Class, Error)]),
        handle_fatal_error(Bridge)
    end.

have next output:

Erlang-21:

boss_web_controller_handle_request:30:{"Bridge",
                                       {sbw,cowboy_simple_bridge,
                                        {cowboy_bridge,
                                         #Ref<0.551478481.3576430593.55775>},
                                        false,[],[],[],none,
                                        #{<<"accept">> =>                                           <<"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8">>,
                                          <<"accept-encoding">> =>
                                           <<"gzip, deflate, br">>,
                                          <<"accept-language">> =>
                                           <<"ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7">>,
                                          <<"cache-control">> =>
                                           <<"max-age=0">>,
                                          <<"connection">> => <<"keep-alive">>,
                                          <<"host">> => <<"localhost:8001">>,
                                          <<"upgrade-insecure-requests">> =>
                                           <<"1">>,
                                          <<"user-agent">> =>
                                           <<"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.96 Safari/537.36">>},
                                        [],
                                        {response,200,[],[],[]}}}

boss_web_controller_handle_request:32:{"LoadedApplications",[mynewproject]}

21:23:52.807 [error] error:badarg: [{erlang,apply ...

so problem with line FullUrl = Bridge:path(), because Bridge is tuple, so there is we try to use parametrized module, but now see erlang-21 change log:

  OTP-14497    Application(s): compiler, erts

               *** POTENTIAL INCOMPATIBILITY ***

               Support for "tuple calls" have been removed from the
               run-time system. Tuple calls was an undocumented and
               unsupported feature which allowed the module argument
               for an apply operation to be a tuple: Var = dict:new(),
               Var:size(). This "feature" frequently caused confuses,
               especially when such call failed. The stacktrace would
               point out functions that don't exist in the source
               code.

               For legacy code that need to use parameterized modules
               or tuple calls for some other reason, there is a new
               compiler option called tuple_calls. When this option is
               given, the compiler will generate extra code that
               emulates the old behavior for calls where the module is
               a variable.

so we need to add tuple_calls to compile flags, unfortunely i don't know how to do this - {erl_opts, [tuple_calls]}. in rebar.config and -compile(tuple_calls). in boss_web_controller_handle_request doesn't help

P.S.
Just try (dict:new()):size(). on erlang-20 and erlang-21 to see this error

@danikp
Copy link
Contributor

danikp commented Mar 18, 2019

current version of CB doew not support Erlang 21, supported versions are 19-20

@mucholove
Copy link

mucholove commented Dec 3, 2019

Getting similar errors. Website says Erlang 20+ and I am running 22

root@personal-assisant:~/my-project# ./init-dev.sh
Erlang/OTP 22 [erts-10.5.6] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1]

{"init terminating in do_boot",{undef,[{reloader,start,[],[]},{init,start_em,1,[]},{init,do_boot,3,[]}]}}
init terminating in do_boot ({undef,[{reloader,start,[],[]},{init,start_em,1,[]},{init,do_boot,3,[]}]})

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

I actually don't know how to install an earlier version but I'm sure I will figure it out soon.

UPDATE:

Got it:

wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
apt-get install esl-erlang=1:20.3

So now I have a different error and I suspect that it may have to do with OpenSSL because I got an error when building from source. (This is Ubutnu 16)

The hunt continues!

UPDATE 2:

Now I've tried 2 installs. One as above and the other with Kerl on my Mac. Not working. :/

=PROGRESS REPORT==== 3-Dec-2019::19:21:45 ===
          supervisor: {local,kernel_safe_sup}
             started: [{pid,<0.72.0>},
                       {id,disk_log_server},
                       {mfargs,{disk_log_server,start_link,[]}},
                       {restart_type,permanent},
                       {shutdown,2000},
                       {child_type,worker}]
{"init terminating in do_boot",{undef,[{reloader,start,[],[]},{init,start_em,1,[]},{init,do_boot,3,[]}]}}
init terminating in do_boot ({undef,[{reloader,start,[],[]},{init,start_em,1,[]},{init,do_boot,3,[]}]})

Crash dump is being written to: erl_crash.dump...done
---
Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]

@khonkonen
Copy link

Good to see that I am not alone, hit the same wall. I downloaded the "developer's build." I understood that during the compile of CB there was the sub-componnent erlydtl checking the Erlang OTP runtime. I hacked the rebar.config file located in the ../src/ChicagoBoss/deps/erlydtl and re-ran the Make, but then hit the wall that the other technologists hit.

Open question @NoobsEnslaver @mucholove : Is it possible to downgrade the Erlang runtime on my machine without breaking applications running a version of Erlang, and then forced to backport RabbitMQ (which is the main application I am worried about)

I could spin up a VM and tailor the environment to meet Chicago Boss specs, but I also cannot find the required machine specifications from Chicago Boss within their documentation.

@mucholove
Copy link

@khonkonen — I never got it to work :(

@Shpaky
Copy link

Shpaky commented Dec 13, 2020

Same problem. Have error only with erlang-21, with erlang-20 all ok. Make little research, add trace lines into boss_web_controller_handle_request:handle_request this way:

-define(TRACE(X), io:format("~p:~p:~p~n", [?MODULE, ?LINE, X])).

handle_request(Bridge, RouterAdapter) ->
    ?TRACE({"Bridge", Bridge}),
    LoadedApplications = boss_web:get_all_applications(),
    ?TRACE({"LoadedApplications", LoadedApplications}),
    FullUrl = Bridge:path(),
    ?TRACE({"FullUrl", FullUrl}),
    ApplicationForPath = RouterAdapter:find_application_for_path(Bridge,
                                                                  FullUrl,
                                                                  LoadedApplications),
    ?TRACE({"ApplicationForPath", ApplicationForPath}),
    try
       handle_application(Bridge, FullUrl, ApplicationForPath, RouterAdapter)
    catch Class:Error ->
        %% Nuclear option: Something very serious happened and we don't want to
        %% fail silently, but instead it should generate an error message.
        _ = lager:error("Unhandled Error: ~s", [boss_log_util:stacktrace(Class, Error)]),
        handle_fatal_error(Bridge)
    end.

have next output:

Erlang-21:

boss_web_controller_handle_request:30:{"Bridge",
                                       {sbw,cowboy_simple_bridge,
                                        {cowboy_bridge,
                                         #Ref<0.551478481.3576430593.55775>},
                                        false,[],[],[],none,
                                        #{<<"accept">> =>                                           <<"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8">>,
                                          <<"accept-encoding">> =>
                                           <<"gzip, deflate, br">>,
                                          <<"accept-language">> =>
                                           <<"ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7">>,
                                          <<"cache-control">> =>
                                           <<"max-age=0">>,
                                          <<"connection">> => <<"keep-alive">>,
                                          <<"host">> => <<"localhost:8001">>,
                                          <<"upgrade-insecure-requests">> =>
                                           <<"1">>,
                                          <<"user-agent">> =>
                                           <<"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.96 Safari/537.36">>},
                                        [],
                                        {response,200,[],[],[]}}}

boss_web_controller_handle_request:32:{"LoadedApplications",[mynewproject]}

21:23:52.807 [error] error:badarg: [{erlang,apply ...

so problem with line FullUrl = Bridge:path(), because Bridge is tuple, so there is we try to use parametrized module, but now see erlang-21 change log:

  OTP-14497    Application(s): compiler, erts

               *** POTENTIAL INCOMPATIBILITY ***

               Support for "tuple calls" have been removed from the
               run-time system. Tuple calls was an undocumented and
               unsupported feature which allowed the module argument
               for an apply operation to be a tuple: Var = dict:new(),
               Var:size(). This "feature" frequently caused confuses,
               especially when such call failed. The stacktrace would
               point out functions that don't exist in the source
               code.

               For legacy code that need to use parameterized modules
               or tuple calls for some other reason, there is a new
               compiler option called tuple_calls. When this option is
               given, the compiler will generate extra code that
               emulates the old behavior for calls where the module is
               a variable.

so we need to add tuple_calls to compile flags, unfortunely i don't know how to do this - {erl_opts, [tuple_calls]}. in rebar.config and -compile(tuple_calls). in boss_web_controller_handle_request doesn't help

P.S.
Just try (dict:new()):size(). on erlang-20 and erlang-21 to see this error

Hi, it is pretty simple.
It`s necessary to add flag 'tuple_calls' to 'erl_opts' section of 'rebar.config' and 'rebar.config.script' files of 'ChicagoBoss' application and 'tuple_calls' flag to 'compiler_options' section of 'boss.config' your application.

Like example bellow:
{compiler_options, [tuple_calls]}

@Shpaky
Copy link

Shpaky commented Dec 13, 2020

current version of CB doew not support Erlang 21, supported versions are 19-20

I did it with 'Elrang/OTP 21.3', by example above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants