hexpm / hex

Package manager for the Erlang ecosystem.
https://hex.pm
961 stars 184 forks source link

fetching not-selectable dependencies times out #1039

Closed NobbZ closed 1 month ago

NobbZ commented 1 month ago

The behaviour described was initially discovered when updating dependencies in an internal application, and privately discussed with @ericmj.

Observed behaviour was, that mix deps.get --only prod eventually timed out fetching floki which is a only: :test dependency in an umbrella projects "sub application" :frontend. The same :frontend also had a dependency on phoenix_live_view which after the update had an optional dependency on :floky.

Excerpt of the output:

* Getting floki (Hex package)
** (exit) exited in: GenServer.call(:hex_fetcher, {:await, {:tarball, "hexpm", "floki", "0.36.2"}}, 120000)
    ** (EXIT) time out
    (elixir 1.16.2) lib/gen_server.ex:1114: GenServer.call/3
    (hex 2.1.2-dev) lib/hex/scm.ex:150: Hex.SCM.update/1
    (hex 2.1.2-dev) lib/hex/scm.ex:249: Hex.SCM.checkout/1
    (mix 1.16.2) lib/mix/dep/fetcher.ex:64: Mix.Dep.Fetcher.do_fetch/3
    (mix 1.16.2) lib/mix/dep/converger.ex:229: Mix.Dep.Converger.all/8
    (mix 1.16.2) lib/mix/dep/converger.ex:162: Mix.Dep.Converger.init_all/8
    (mix 1.16.2) lib/mix/dep/converger.ex:146: Mix.Dep.Converger.all/4
    (mix 1.16.2) lib/mix/dep/converger.ex:89: Mix.Dep.Converger.converge/4

This behaviour can be reproduced with a bare and freshly generated phoenix application:

$ mix phx.new optional_floki_umbrella --umbrella
[ … snipping init … ]
$ cd optional_floki_umbrella_umbrella
$ rm -rf deps
$ mix deps.get --only prod
Resolving Hex dependencies...
Resolution completed in 0.115s
Unchanged:
  bandit 1.5.2
  castore 1.0.7
  db_connection 2.6.0
  decimal 2.1.1
  dns_cluster 0.1.3
  ecto 3.11.2
  ecto_sql 3.11.2
  esbuild 0.8.1
  expo 0.5.2
  finch 0.18.0
  gettext 0.24.0
  hpax 0.1.2
  jason 1.4.1
  mime 2.0.5
  mint 1.6.0
  nimble_options 1.1.1
  nimble_pool 1.1.0
  phoenix 1.7.12
  phoenix_ecto 4.6.1
  phoenix_html 4.1.1
  phoenix_live_dashboard 0.8.3
  phoenix_live_view 0.20.14
  phoenix_pubsub 2.1.3
  phoenix_template 1.0.4
  plug 1.16.0
  plug_crypto 2.1.0
  postgrex 0.18.0
  swoosh 1.16.9
  tailwind 0.2.2
  telemetry 1.2.1
  telemetry_metrics 1.0.0
  telemetry_poller 1.1.0
  thousand_island 1.3.5
  websock 0.5.3
  websock_adapter 0.5.6
* Getting floki (Hex package)
** (exit) exited in: GenServer.call(:hex_fetcher, {:await, {:tarball, "hexpm", "floki", "0.36.2"}}, 120000)
    ** (EXIT) time out
    (elixir 1.16.2) lib/gen_server.ex:1114: GenServer.call/3
    (hex 2.1.2-dev) lib/hex/scm.ex:150: Hex.SCM.update/1
    (hex 2.1.2-dev) lib/hex/scm.ex:249: Hex.SCM.checkout/1
    (mix 1.16.2) lib/mix/dep/fetcher.ex:64: Mix.Dep.Fetcher.do_fetch/3
    (mix 1.16.2) lib/mix/dep/converger.ex:229: Mix.Dep.Converger.all/8
    (mix 1.16.2) lib/mix/dep/converger.ex:162: Mix.Dep.Converger.init_all/8
    (mix 1.16.2) lib/mix/dep/converger.ex:146: Mix.Dep.Converger.all/4
    (mix 1.16.2) lib/mix/dep/converger.ex:89: Mix.Dep.Converger.converge/4

Please note: The resolved dependencies do not even list floki.

So far I have not managed to reproduce this in a non-umbrella application.

SteffenDE commented 1 month ago

Probably https://github.com/elixir-lang/elixir/issues/13410. As a workaround you should be able to add {:floki, ">= 0.0.0", only: :test} to the mix.exs in your umbrella root and see if that helps.

ericmj commented 1 month ago

https://github.com/elixir-lang/elixir/issues/13410 is very likely the issue and has been fixed in 1.17.0-rc.0. Unfortunately we have to wait for that release.

Closing this but if it's another issue we will reopen.