Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hackney error #61

Open
agramichael opened this issue Sep 11, 2020 · 3 comments
Open

Hackney error #61

agramichael opened this issue Sep 11, 2020 · 3 comments

Comments

@agramichael
Copy link
Contributor

Ran into this error quite a few times:

** (ArgumentError) argument error
            (stdlib 3.13) :ets.lookup_element(:hackney_config, :mod_metrics, 2)
            /Users/michael/Documents/alchemist/deps/hackney/src/hackney_metrics.erl:27: :hackney_metrics.get_engine/0
            /Users/michael/Documents/alchemist/deps/hackney/src/hackney_connect.erl:75: :hackney_connect.create_connection/5
            /Users/michael/Documents/alchemist/deps/hackney/src/hackney_connect.erl:44: :hackney_connect.connect/5
            /Users/michael/Documents/alchemist/deps/hackney/src/hackney.erl:333: :hackney.request/5
            (stdlib 3.13) timer.erl:166: :timer.tc/1
            lib/instream/connection/query_runner.ex:70: Instream.Connection.QueryRunner.read/3

Solved it by adding a Application.ensure_all_started(:hackney) on startup.

@mneudert
Copy link
Owner

Are you by any chance using a custom :applications list (or :included_applications) in your project's Mixfile? Or running a Mix.Task?

"By default" the application startup should detect :hackney as a dependency and ensure it is started early enough to not be a problem.

@agramichael
Copy link
Contributor Author

agramichael commented Sep 14, 2020

The app in my umbrella that has :instream as a dependency doesn't have any extra or included applications.

Yeah I expected :hackney to be detected and started by default. Was surprised when ensuring it was started fixed this.

@mneudert
Copy link
Owner

I somehow managed to construct an umbrella application that can force a startup error: https://github.com/mneudert/instream-issue_61

The example is extremely contrived by sending a request through hackney from a dependency "next" to :instream without directly depending on it (see second to last commit). Adding an entry to :extra_applications fixed the issue (see most recent commit) without having to reorder the dependency tree in the umbrella.

If you are building a release and see the issue you could look at the startup file (i.e. _build/dev/rel/your_app/releases/0.1.0/start.script) to see the application order. The block at the end of the file between {progress,applications_loaded} and {progress,started} might show the actual app trying to send the early request. Ideally all your applications are listed below :hackney, otherwise some more wild testing may be necessary to replicate the problem 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants