Code Monkey home page Code Monkey logo

Comments (7)

NoobsEnslaver avatar NoobsEnslaver commented on May 25, 2024

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

from chicagoboss.

danikp avatar danikp commented on May 25, 2024

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

from chicagoboss.

mucholove avatar mucholove commented on May 25, 2024

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]

from chicagoboss.

khonkonen avatar khonkonen commented on May 25, 2024

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.

from chicagoboss.

mucholove avatar mucholove commented on May 25, 2024

@khonkonen — I never got it to work :(

from chicagoboss.

Shpaky avatar Shpaky commented on May 25, 2024

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]}

from chicagoboss.

Shpaky avatar Shpaky commented on May 25, 2024

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.

from chicagoboss.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.