kittoframework/kitto

Mix deps.compile hangs : Package <<"pc">> not found

mukulashokjoshi opened this issue · 9 comments

Environment

Environment is behind corporate firewall.

  • Elixir / Hex version (mix hex.info):
    Hex: 0.14.1
    Elixir: 1.3.4
    OTP: 19.1.5

Built with: Elixir 1.3.4 and OTP 18.3.4.4

  • Node / NPM version (node -v) (npm -v):

node: v6.9.2

npm: 3.10.9

  • Operating system:

Ubuntu 16.10 Yakkety Yak

Current behavior

Compilation hangs while trying to get the "pc" package:

$ mix kitto.server
===> Compiling idna
===> Compiling mimerl
===> Compiling metrics
===> Package <<"pc">> not found. Fetching registry updates and trying again...
===> Updating package registry...

Expected behavior

I think this has to do with one of our dependencies needing the pc rebar plugin see: https://github.com/synrc/fs/blob/master/rebar.config#L15

can you try:

  • mix deps.clean
  • mix deps.get
  • mix deps.compile
  • mix kitto.server

The expected behaviour during the compilation step is to have output like the following:

===> Compiling mimerl
===> Compiling metrics
===> Fetching pc ({pkg,<<"pc">>,<<"1.4.0">>})
===> Downloaded package, caching at /home/zorbash/.cache/rebar3/hex/default/packages/pc-1.4.0.tar
===> Compiling pc
``

@zorbash thanks for the observations

Taking your cue, specifically started looking at rebar3 and pc. Noticed some crash dump files in the deps/fs folder. But they are not generated always.

Checked the ~/.cache/rebar3 folder. This seemed to be empty except for a default folder which was also empty. Then followed the instructions for installing rebar3 from this URL: https://github.com/erlang/rebar3. This then created the requisite files in the ~/.cache/rebar3 folder

After the above steps, the compilation goes ahead but still not able to fetch the pc and rebar3_hex package:

===> Compiling idna
===> Compiling mimerl
===> Compiling metrics
===> Fetching pc ({pkg,<<"pc">>,<<"1.4.0">>})
===> Plugin pc not available. It will not be used.
===> Fetching rebar3_hex ({pkg,<<"rebar3_hex">>,<<"3.0.0">>})
===> Plugin rebar3_hex not available. It will not be used.
===> Fetching pc ({pkg,<<"pc">>,<<"1.4.0">>})

Although you issue seems more specific to mix/rebar let's see if we can resolve it.

Can you run:

mix local.rebar
rm -rf deps
rm -rf _build
mix local.rebar --force # Force mix to reinstall rebar for you
mix deps.get

You can also ask on gitter for more interactive troubleshooting 🎄

@zorbash thanks

Followed your instructions, but the compile still waits trying to fetch pc/rebar3_hex

From the previous run, the following is from the rebar3.crashdump in the folder deps/fs:

Error: terminated
[{io,format,
     [<0.49.0>,"===> Plugin ~p not available. It will not be used.~n",
      [rebar3_hex]],
     []},
 {rebar_plugins,handle_plugin,4,
                [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_plugins.erl"},
                 {line,117}]},
 {rebar_plugins,'-handle_plugins/4-fun-0-',4,
                [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_plugins.erl"},
                 {line,83}]},
 {lists,foldl,3,[{file,"lists.erl"},{line,1263}]},
 {rebar_plugins,handle_plugins,4,
                [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_plugins.erl"},
                 {line,82}]},
 {rebar_plugins,'-project_apps_install/1-fun-1-',4,
                [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_plugins.erl"},
                 {line,43}]},
 {lists,foldl,3,[{file,"lists.erl"},{line,1263}]},
 {rebar_prv_app_discovery,do,1,
                          [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_prv_app_discovery.erl"},
                           {line,39}]}]

There was also a erl_crash.dump in the same folder which is quite a large file and so not able to summarise here.

Can you please paste here the contents of your mix.lock?

@zorbash thanks

I tested this on another machine (a home machine with almost similar config - ubuntu 16.04/Linux mint, elixir 1.3.2, erlang 19 but no proxy) and was able to successfully compile though there were some issues which were resolved by your initial suggestions like removing the deps/_build folder and doing the deps compile.

The mix.lock generated is as follows (for the successful compile):

%{"certifi": {:hex, :certifi, "0.7.0", "861a57f3808f7eb0c2d1802afeaae0fa5de813b0df0979153cbafcd853ababaf", [:rebar3], []},
  "cowboy": {:hex, :cowboy, "1.0.4", "a324a8df9f2316c833a470d918aaf73ae894278b8aa6226ce7a9bf699388f878", [:rebar, :make], [{:cowlib, "~> 1.0.0", [hex: :cowlib, optional: false]}, {:ranch, "~> 1.0", [hex: :ranch, optional: false]}]},
  "cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec0f7e08b1df84ee", [:make], []},
  "fs": {:hex, :fs, "2.12.0", "ad631efacc9a5683c8eaa1b274e24fa64a1b8eb30747e9595b93bec7e492e25e", [:rebar3], []},
  "hackney": {:hex, :hackney, "1.6.5", "8c025ee397ac94a184b0743c73b33b96465e85f90a02e210e86df6cbafaa5065", [:rebar3], [{:certifi, "0.7.0", [hex: :certifi, optional: false]}, {:idna, "1.2.0", [hex: :idna, optional: false]}, {:metrics, "1.0.1", [hex: :metrics, optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, optional: false]}]},
  "httpoison": {:hex, :httpoison, "0.10.0", "4727b3a5e57e9a4ff168a3c2883e20f1208103a41bccc4754f15a9366f49b676", [:mix], [{:hackney, "~> 1.6.3", [hex: :hackney, optional: false]}]},
  "idna": {:hex, :idna, "1.2.0", "ac62ee99da068f43c50dc69acf700e03a62a348360126260e87f2b54eced86b2", [:rebar3], []},
  "kitto": {:hex, :kitto, "0.3.2", "9d672bb67479d5ae4c7319694b15ae11a97d1719d7395d029b9c858e7613399c", [:mix], [{:cowboy, "~> 1.0.0", [hex: :cowboy, optional: false]}, {:fs, "~> 2.12.0", [hex: :fs, optional: false]}, {:httpoison, "~> 0.10.0", [hex: :httpoison, optional: false]}, {:plug, "~> 1.3", [hex: :plug, optional: false]}, {:poison, "~> 3.0", [hex: :poison, optional: false]}]},
  "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], []},
  "mime": {:hex, :mime, "1.0.1", "05c393850524767d13a53627df71beeebb016205eb43bfbd92d14d24ec7a1b51", [:mix], []},
  "mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], []},
  "plug": {:hex, :plug, "1.3.0", "6e2b01afc5db3fd011ca4a16efd9cb424528c157c30a44a0186bcc92c7b2e8f3", [:mix], [{:cowboy, "~> 1.0.1 or ~> 1.1", [hex: :cowboy, optional: true]}, {:mime, "~> 1.0", [hex: :mime, optional: false]}]},
  "poison": {:hex, :poison, "3.0.0", "625ebd64d33ae2e65201c2c14d6c85c27cc8b68f2d0dd37828fde9c6920dd131", [:mix], []},
  "ranch": {:hex, :ranch, "1.2.1", "a6fb992c10f2187b46ffd17ce398ddf8a54f691b81768f9ef5f461ea7e28c762", [:make], []},
  "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:rebar, :make], []}}

I will retest on the corporate machine which is behind firewall and come back on same

Since it's clear now that your issue is about not being to install a package due to a proxy/firewall, I have to close this issue. Although this issue tracker is not intended for mix troubleshooting, I recommend giving https://hex.pm/docs/tasks#hex a look about available proxy configuration settings.

@zorbash thanks

When using proxy, below is the DEBUG trace:

===> error: function_clause [{string,substr2,
                                 [<<"http://127.0.0.1:3128/">>,1],
                                 [{file,"string.erl"},{line,213}]},
                             {string,substr,3,
                                 [{file,"string.erl"},{line,208}]},
                             {http_uri,split_uri,5,
                                 [{file,"http_uri.erl"},{line,201}]},
                             {http_uri,parse_scheme,2,
                                 [{file,"http_uri.erl"},{line,137}]},
                             {http_uri,parse,2,
                                 [{file,"http_uri.erl"},{line,89}]},
                             {rebar3_hex_http,maybe_setup_proxy,2,
                                 [{file,
                                      "../deps/fs/_build/default/plugins/rebar3_hex/src/rebar3_hex_http.erl"},
                                  {line,122}]},
                             {rebar3_hex_http,maybe_setup_proxy,0,
                                 [{file,
                                      "../deps/fs/_build/default/plugins/rebar3_hex/src/rebar3_hex_http.erl"},
                                  {line,116}]},
                             {rebar3_hex,init,1,
                                 [{file,
                                      "../deps/fs/_build/default/plugins/rebar3_hex/src/rebar3_hex.erl"},
                                  {line,7}]}]
===> Failed creating providers. Run with DEBUG=1 for stacktrace or consult rebar3.crashdump.
** (Mix) Could not compile dependency :fs, "../.asdf/installs/elixir/1.3.4/.mix/rebar3 bare compile --paths "../_build/dev/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile fs", update it with "mix deps.update fs" or clean it with "mix deps.clean fs"

Have also raised on the rebar3_hex code base: erlef/rebar3_hex#62

Finally succeeded in compiling by removing the hex.config keys http_proxy and https_proxy as these were resulting in function_clause error in the rebar3_hex

Hex config keys deleted as follows:

mix hex.config http_proxy --delete
mix hex.config https_proxy --delete