Search code examples
erlangelixirphoenix-framework

How to debug phoenix framework's log error?


I am installing this pheonix web app: https://github.com/poanetwork/blockscout

after installed all the dependencies, I run this command ( following the document) :

$ mix phx.server

and got error:

$ iex -S mix phx.server
Erlang/OTP 25 [erts-13.1.2] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [jit:ns]

2022-12-13T04:25:43.083 [notice] Application ethereum_jsonrpc exited: EthereumJSONRPC.Application.start(:normal, []) returned an error: shutdown: failed to start child: :worker
    ** (EXIT) an exception was raised:
        ** (MatchError) no match of right hand side value: {:error, :badarg}
            (poolboy 1.5.2) /opt/app/blockscout/deps/poolboy/src/poolboy.erl:283: :poolboy.new_worker/1
            (poolboy 1.5.2) /opt/app/blockscout/deps/poolboy/src/poolboy.erl:304: :poolboy.prepopulate/3
            (poolboy 1.5.2) /opt/app/blockscout/deps/poolboy/src/poolboy.erl:153: :poolboy.init/3
            (stdlib 4.1.1) gen_server.erl:851: :gen_server.init_it/2
            (stdlib 4.1.1) gen_server.erl:814: :gen_server.init_it/6
            (stdlib 4.1.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
2022-12-13T04:25:43.106 [notice] Application poolboy exited: :stopped
2022-12-13T04:25:43.106 [notice] Application decorator exited: :stopped
2022-12-13T04:25:43.106 [notice] Application decimal exited: :stopped
2022-12-13T04:25:43.106 [notice] Application websocket_client exited: :stopped
2022-12-13T04:25:43.106 [notice] Application ex_abi exited: :stopped
2022-12-13T04:25:43.106 [notice] Application ex_keccak exited: :stopped
2022-12-13T04:25:43.106 [notice] Application rustler exited: :stopped
2022-12-13T04:25:43.107 [notice] Application timex exited: :stopped
2022-12-13T04:25:43.107 [notice] Application gettext exited: :stopped
2022-12-13T04:25:43.108 [notice] Application combine exited: :stopped
2022-12-13T04:25:43.110 [notice] Application tzdata exited: :stopped
2022-12-13T04:25:43.110 [notice] Application spandex_datadog exited: :stopped
2022-12-13T04:25:43.111 [notice] Application msgpax exited: :stopped
2022-12-13T04:25:43.111 [notice] Application spandex exited: :stopped
2022-12-13T04:25:43.111 [notice] Application plug exited: :stopped
2022-12-13T04:25:43.111 [notice] Application telemetry exited: :stopped
2022-12-13T04:25:43.112 [notice] Application plug_crypto exited: :stopped
2022-12-13T04:25:43.112 [notice] Application mime exited: :stopped
2022-12-13T04:25:43.112 [notice] Application eex exited: :stopped
2022-12-13T04:25:43.112 [notice] Application optimal exited: :stopped
2022-12-13T04:25:43.112 [notice] Application logger_file_backend exited: :stopped
2022-12-13T04:25:43.112 [notice] Application jason exited: :stopped
2022-12-13T04:25:43.112 [notice] Application httpoison exited: :stopped
2022-12-13T04:25:43.113 [notice] Application hackney exited: :stopped
2022-12-13T04:25:43.113 [notice] Application metrics exited: :stopped
2022-12-13T04:25:43.113 [notice] Application ssl_verify_fun exited: :stopped
2022-12-13T04:25:43.113 [notice] Application parse_trans exited: :stopped
2022-12-13T04:25:43.113 [notice] Application syntax_tools exited: :stopped
2022-12-13T04:25:43.113 [notice] Application mimerl exited: :stopped
2022-12-13T04:25:43.113 [notice] Application idna exited: :stopped
2022-12-13T04:25:43.113 [notice] Application unicode_util_compat exited: :stopped
2022-12-13T04:25:43.113 [notice] Application cowboy exited: :stopped
2022-12-13T04:25:43.114 [notice] Application ranch exited: :stopped
2022-12-13T04:25:43.114 [notice] Application cowlib exited: :stopped
2022-12-13T04:25:43.114 [notice] Application certifi exited: :stopped
** (Mix) Could not start application ethereum_jsonrpc: EthereumJSONRPC.Application.start(:normal, []) returned an error: shutdown: failed to start child: :worker
    ** (EXIT) an exception was raised:
        ** (MatchError) no match of right hand side value: {:error, :badarg}
            (poolboy 1.5.2) /opt/app/blockscout/deps/poolboy/src/poolboy.erl:283: :poolboy.new_worker/1
            (poolboy 1.5.2) /opt/app/blockscout/deps/poolboy/src/poolboy.erl:304: :poolboy.prepopulate/3
            (poolboy 1.5.2) /opt/app/blockscout/deps/poolboy/src/poolboy.erl:153: :poolboy.init/3
            (stdlib 4.1.1) gen_server.erl:851: :gen_server.init_it/2
            (stdlib 4.1.1) gen_server.erl:814: :gen_server.init_it/6
            (stdlib 4.1.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3

I found there is no stack trace for the source code, all the stack trace that can be seen is the dependencies'.

so my question is: how to know which line of the source code of this eror occured at?

thanks.


Solution

  • The error happened before your application even attempted to start.

    ErlangVM attempts to start all the applications yours depends on upfront, and the error

    Application ethereum_jsonrpc exited:
         EthereumJSONRPC.Application.start(:normal, []) returned an error:
           shutdown: failed to start child: :worker
        ** (EXIT) an exception was raised:
            ** (MatchError) no match of right hand side value: {:error, :badarg}
    

    basically means that ethereum_jsonrpc application failed to start preventing ErlangVM from trying to start the main application. To narrow down the issue, one might try to start the failing ethereum_jsonrpc explicitly, e. g. from iex session with Application.ensure_all_started(:ethereum_jsonrpc) or with more explicit EthereumJSONRPC.Application.start(:normal, []).