hackney icon indicating copy to clipboard operation
hackney copied to clipboard

Application crashes when configuring mod_metrics to exometer

Open ianwalter opened this issue 10 years ago • 12 comments

I have the following config:

config :hackney,
  mod_metrics: :exometer

When I try to start my Phoenix application I get:

{"Kernel pid terminated",application_controller,"{application_start_failure,hackney,{bad_return,{{hackney_app,start,[normal,[]]},{'EXIT',{{badmatch,{error,{shutdown,{failed_to_start_child,hackney_manager,{noproc,{gen_server,call,[exometer_admin,{ensure,[hackney,nb_requests],counter,[]}]}}}}}},[{hackney_sup,start_link,0,[{file,\"src/hackney_sup.erl\"},{line,27}]},{application_master,start_it_old,4,[{file,\"application_master.erl\"},{line,273}]}]}}}}}"}

Crash dump is being written to: erl_crash.dump...done
Kernel pid terminated (application_controller) ({application_start_failure,hackney,{bad_return,{{hackney_app,start,[normal,[]]},{'EXIT',{{badmatch,{error,{shutdown,{failed_to_start_child,hackney_manag

If I comment out the config, the application starts up and the exometer reporter works. I'm using Hackney 1.6.3, exometer_core master, exometer_influxdb master, and Erlang/OTP 19. Anyone have any ideas on what I'm doing wrong?

ianwalter avatar Nov 08 '16 05:11 ianwalter

I created a repo that reproduces the issue in case it may help: https://github.com/ianwalter/hackney_metrics

ianwalter avatar Nov 10 '16 00:11 ianwalter

thanks I will have a look at it.

benoitc avatar Nov 12 '16 07:11 benoitc

This was caused by application order I believe. Having a different issue but closing this one.

ianwalter avatar Nov 23 '16 17:11 ianwalter

@ianwalter I'm having the same issue / with same setup. I'm also starting hackney (httpoison) after exometer in mix.exs. What did you change in application order to get it to work?

nickjacob avatar Dec 22 '16 15:12 nickjacob

I'm having this issue too. I get the following error on an elixir umbrella project:

** (Mix) Could not start application hackney: exited in: :hackney_app.start(:normal, [])
    ** (EXIT) an exception was raised:
        ** (MatchError) no match of right hand side value: {:error, {:shutdown, {:failed_to_start_child, :hackney_manager, {:noproc, {:gen_server, :call, [:exometer_admin, {:ensure, [:hackney, :nb_requests], :counter, []}]}}}}}
            (hackney) /Users/paco/dev/github/cabify/product_ex_core/deps/hackney/src/hackney_sup.erl:27: :hackney_sup.start_link/0
            (kernel) application_master.erl:273: :application_master.start_it_old/4

If I have the following apps configured to be started

[:httpoison, :exometer_core]

It does not work, but work if I change the order

[:exometer_core, :httpoison]

Any suggestion in how can I avoid this error. This is the exometer configuration that I'm testing

config :exometer,
  predefined:
    [
      {
        ~w(hackney nb_requests)a,
        :counter,
        []
      },
      {
        ~w(hackney total_requests)a,
        :counter,
        []
      },
      {
        ~w(hackney finished_requests)a,
        :counter,
        []
      },
      {
        ~w(hackney_pool default take_rate)a,
        :histogram,
        []
      },
      {
        ~w(hackney_pool default no_socket)a,
        :counter,
        []
      },
      {
        ~w(hackney_pool default in_use_count)a,
        :histogram,
        []
      },
      {
        ~w(hackney_pool default free_count)a,
        :histogram,
        []
      },
      {
        ~w(hackney_pool default queue_counter)a,
        :histogram,
        []
      }
    ],

  reporters: [{reporter, reporter_ops}],

  report: [
    subscribers:
      [
        {
          reporter,
          [:hackney, :nb_requests], :value, polling_interval, true
        },
        {
          reporter,
          [:hackney, :total_requests], :value, polling_interval, true
        },
        {
          reporter,
          [:hackney, :finished_requests], :value, polling_interval, true
        },
        {
          reporter,
          [:hackney_pool, :default, :take_rate], histogram_stats, polling_interval, true
        },
        {
          reporter,
          [:hackney_pool, :default, :no_socket], :value, polling_interval, true
        },
        {
          reporter,
          [:hackney_pool, :default, :in_use_count], histogram_stats, polling_interval, true
        },
        {
          reporter,
          [:hackney_pool, :default, :free_count], histogram_stats, polling_interval, true
        },
        {
          reporter,
          [:hackney_pool, :default, :queue_counter], histogram_stats, polling_interval, true
        }
      ]
  ]

Thanks in advance

pacoguzman avatar Mar 29 '17 09:03 pacoguzman

You will need to start exometer first. It's needed so hackney can init the metrics at startup.

benoitc avatar Mar 29 '17 09:03 benoitc

Cool thanks!

pacoguzman avatar Mar 29 '17 11:03 pacoguzman

I am still having this issue. I am having a difficult time resolving it. I am starting exometer (elixometer) before hackney (httpoison) in my mix file, but am seeing the following error --

    ** (EXIT) an exception was raised:
        ** (MatchError) no match of right hand side value: {:error, {:shutdown, {:failed_to_start_child, :hackney_manager, {:noproc, {:gen_server, :call, [:exometer_admin, {:ensure, [:hackney, :nb_requests], :counter, []}]}}}}}
            (hackney) /Users/msmykowski/Br/djay/deps/hackney/src/hackney_sup.erl:27: :hackney_sup.start_link/0
            (kernel) application_master.erl:273: :application_master.start_it_old/4```

msmykowski avatar Oct 25 '17 18:10 msmykowski

This doesn't work when bundled into a release. Even setting the :applications explicitly and it still won't start up. 👎

mgwidmann avatar Jun 22 '19 05:06 mgwidmann

@mgwidmann can you be more explict. what is the error, how applications are started’ what is the result? That would help. Also this ticket is closed, please open a new one with the details :)

benoitc avatar Jun 22 '19 06:06 benoitc

@msmykowski this error means tje process of exometer is not started. what version of elixir are you running?

benoitc avatar Jun 22 '19 06:06 benoitc

@benoitc more details are in #567 so we can discuss further there...

mgwidmann avatar Jun 24 '19 13:06 mgwidmann