-
Notifications
You must be signed in to change notification settings - Fork 29
:gen_event handler #346
Comments
I tracked it down to a request to
|
Thanks for filing this. Oh how I dislike hackney, we've wasted so much time debugging it. @mitchellhenke will take a crack at this. |
Thank you @binarylogic and @mitchellhenke - if it helps I also ensured hackney was started in the iex console - I did an Application.started_applications/1 in the iex console on the remote environment and it showed |
@treble37 and you still see the error? |
Yes, @mitchellhenke unfortunately....(I didn't have to start |
@treble37 that'd be great 🙂 |
@mitchellhenke - here you go (with a "sanitized" auth token):
|
I also haven't updated to the latest timber_ecto (running 2.1.0 rather than 2.1.1) if you think that might make a difference... |
huh, that's odd. My suspicion was that the Does the failure happen in any of the umbrella apps if you try it, or just the one? Also what version of hackney are you on? |
So with our remote setup, I start the iex shell in the top level of the umbrella application, which I thought means I'm interacting with all of the applications normally? Here's the timber stuff from the mix.lock:
Hackney is 1.9 apparently...there are also other versions of hackney specified for different deps like tzdata - can paste those too if needed. |
Do you have timber installed in the root umbrella application? |
So timber 3.1.1 is listed as a dependency in each of our 2 umbrella applications that use it in their respective mix.exs files. The top level mix.exs file does not have timber listed as a dependency if that's what you mean. |
I created a minimal app here to try to reproduce as you've described, but I wasn't able to get the same behavior. The Do your applications use the |
For the umbrella that holds our repositories, in mix.exs we have:
The other mix.exs for our web endpoints:
Thanks for making that test app.... |
You mentioned that it happened on the server, but not locally. Is there a different configuration or something else like that, like deploying with Distillery? |
Oh yes, it is deployed with distillery @mitchellhenke |
Dang, I tried a release with distillery and was not able to reproduce (I've updated my example repo with it as well). I'm not sure on the next step to debug this 😕 |
What cloud provider are you deploying to out of curiosity? Amazon? Google? I might try deploying your sample app.... |
@treble37 I hadn't deployed it anywhere, just locally. |
Oh I see, thanks, yes locally I don't have this issue either. It just seems to be an issue in the remote environment. I was hoping it might be a simple config issue, but so far it's looking like it's not. Let me see if I can replicate with your sample application. |
One thing I did now notice - the app that caused this issue (call it App X) had timber requiring "~> hackney 1.9.0" in the mix.lock as a dependency, but there was also a separate line in mix.lock calling for
I don't know why it's there (and I can change it), but do you know if timber-elixir has been tested to work with hackney 1.15.1 ? |
I added that version to my example because your comment here looked like the app was on hackney 1.9.0: #346 (comment) The example app works for me with hackney 1.9.0 and hackney 1.15.1 |
yes, thank you @mitchellhenke for bearing with me, in somewhat "better" news, I made a private branch for your example app (I should add I made a few config changes - notably I added an umbrella phoenix app and removed ":console" value from
Note: I'm including some of the basic troubleshooting things I did in console as well. Let me know if you can think of anything else I can do to help that would make troubleshooting on your end easier. Can provide the google cloud machine type, etc. |
When running Logger.info/1 in a remote console, hackney seems to throw an argument error when making a request. This is a workaround. Addresses vectordotdev#346
@mitchellhenke - just made the PR to document the workaround I came up with at the moment. |
When running Logger.info/1 in a remote console, hackney seems to throw an argument error when making a request. This is a workaround. Addresses #346
@treble37 if I understand correctly, your PR does not solve the issue only covers it so there is no exception thrown. The requests still fail. Have you found the solution to this problem? I have precisely the same issue... |
@hubertlepicki, unfortunately, I haven't come up with something better. You still can't seem to issue Logger requests from a remote_console. Fortunately, timber logging in a non-remote context seems to work (ie, works from the app I'm running). I think one of the timber contributors said somewhere they were going to remove hackney at some point as it has given them a bit of trouble. |
I believe I'm seeing a similar issue when trying to stop my app, which was started from Distillery. It causes the app to fail to stop cleanly, and I end up having to kill the beam app and related processes.
|
We have the same issue and it makes it impossible to create a remote_console on the distillery release and run ad-hoc functions that log anything. |
Seeing the same issue: iex(skoach@127.0.0.1)3> Logger.info("test from prod")
2019-11-14 15:51:23.373 [info] test from prod
:ok
iex(skoach@127.0.0.1)4> 2019-11-14 15:51:23.742 [error] :gen_event handler Timber.LoggerBackends.HTTP installed in Logger terminating
** (ArgumentError) argument error
(stdlib) :ets.lookup_element(:hackney_config, :mod_metrics, 2)
(hackney) /builds/skoach/skoach-bot/deps/hackney/src/hackney_metrics.erl:26: :hackney_metrics.get_engine/0
(hackney) /builds/skoach/skoach-bot/deps/hackney/src/hackney_connect.erl:78: :hackney_connect.create_connection/5
(hackney) /builds/skoach/skoach-bot/deps/hackney/src/hackney_connect.erl:47: :hackney_connect.connect/5
(hackney) /builds/skoach/skoach-bot/deps/hackney/src/hackney.erl:333: :hackney.request/5
(timber) lib/timber/logger_backends/http.ex:396: Timber.LoggerBackends.HTTP.transmit_buffer/2
(timber) lib/timber/logger_backends/http.ex:211: Timber.LoggerBackends.HTTP.handle_info/2
(stdlib) gen_event.erl:577: :gen_event.server_update/4
Last message: :flush
2019-11-14 15:51:23.744 [error] GenServer #PID<0.107.0> terminating
** (stop) {:EXIT, {:badarg, [{:ets, :lookup_element, [:hackney_config, :mod_metrics, 2], []}, {:hackney_metrics, :get_engine, 0, [file: '/builds/skoach/skoach-bot/deps/hackney/src/hackney_metrics.erl', line: 26]}, {:hackney_connect, :create_connection, 5, [file: '/builds/skoach/skoach-bot/deps/hackney/src/hackney_connect.erl', line: 78]}, {:hackney_connect, :connect, 5, [file: '/builds/skoach/skoach-bot/deps/hackney/src/hackney_connect.erl', line: 47]}, {:hackney, :request, 5, [file: '/builds/skoach/skoach-bot/deps/hackney/src/hackney.erl', line: 333]}, {Timber.LoggerBackends.HTTP, :transmit_buffer, 2, [file: 'lib/timber/logger_backends/http.ex', line: 396]}, {Timber.LoggerBackends.HTTP, :handle_info, 2, [file: 'lib/timber/logger_backends/http.ex', line: 211]}, {:gen_event, :server_update, 4, [file: 'gen_event.erl', line: 577]}]}}
Last message: {:gen_event_EXIT, Timber.LoggerBackends.HTTP, {:EXIT, {:badarg, [{:ets, :lookup_element, [:hackney_config, :mod_metrics, 2], []}, {:hackney_metrics, :get_engine, 0, [file: '/builds/skoach/skoach-bot/deps/hackney/src/hackney_metrics.erl', line: 26]}, {:hackney_connect, :create_connection, 5, [file: '/builds/skoach/skoach-bot/deps/hackney/src/hackney_connect.erl', line: 78]}, {:hackney_connect, :connect, 5, [file: '/builds/skoach/skoach-bot/deps/hackney/src/hackney_connect.erl', line: 47]}, {:hackney, :request, 5, [file: '/builds/skoach/skoach-bot/deps/hackney/src/hackney.erl', line: 333]}, {Timber.LoggerBackends.HTTP, :transmit_buffer, 2, [file: 'lib/timber/logger_backends/http.ex', line: 396]}, {Timber.LoggerBackends.HTTP, :handle_info, 2, [file: 'lib/timber/logger_backends/http.ex', line: 211]}, {:gen_event, :server_update, 4, [file: 'gen_event.erl', line: 577]}]}}} On elixir 1.9, timber 3.1.2. |
Can confirm. Timber logging works when in iex , but not when using releases built by distillery and in remote_console |
I just ran into this issue, is there any way to resolve this? |
@zacksiri Nope, no fix. It happens in iex, but only in a release built by distillery. So when you use remote_console it won't work. |
Hello, so on a staging environment box, I'm getting the below in an iex console for a Phoenix application....The error message is rather cryptic, so it's unclear what is wrong. Any tips in the right direction?
I followed the docs:
https://docs.timber.io/setup/languages/elixir
which say:
We are getting at least some debug logs in staging for timber.io, so it seems the setup and configuration of Timber is line with what needs to be done via the docs.
Here is the timber deps in our mix.exs file for one part of our umbrella app:
And the timber deps in mix.exs for another app in our umbrella app:
If I setup my local machine with the same credentials as the staging box and to use the Timber HTTP backend, I don't get the above issue.
The text was updated successfully, but these errors were encountered: