-
Notifications
You must be signed in to change notification settings - Fork 85
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
Functions raise if port dies #20
Comments
@benwilson512 I was able to find a solution to the second problem of having the server reconnect. We use a defmodule Metrics do
use Statix
use GenServer
def init(_opts) do
Process.flag(:trap_exit, true)
connect()
{:ok, current_conn()}
end
def handle_info({:EXIT, port, reason}, %Statix.Conn{sock: __MODULE__} = state) do
Logger.error("Port #{inspect(port)} exited with reason #{reason}")
{:stop, :normal, state}
end
end Basically this This could lead to a restart loop, but using appropriate supervisor strategies you can define policies for the restart loop. By default when you call -- For the other problem of |
@thecodeboss that solves the issue of reconnecting, but any metrics calls that happen between when it fails and when it restarts will raise. The inability to send a metric shouldn't take down a process. |
Hey, do you have any reliable way to trigger port dying? |
@lexmag |
I think the issue brought up in the issue is related to the usage documentation. The problem with the way it is documented is that it tells users to call the When the port closes and you try to call any of the APIs that call |
@scrogson thanks, but I wondered more on how (and why) the port gets closed in non-manual way. |
We've seen the port die if it can't communicate with the agent in a variety of ways: agent restarts, netsplits, etc. |
@keathley 👍. I think the ultimate fix for this would be to provide |
I do think that's a solution, but I also think that wrapping the port operations in a |
That's definitely what we should do of course. |
Hey folks,
Maybe I'm doing something wrong, but if my statsd agent restarts all function calls end up raising as:
This seems undesirable, monitoring functions shouldn't nuke the app in the event that the port goes down.
Ideally there'd be some mechanism for trying to reconnect as well, but at a minimum it would seem we probably want to catch this error.
The text was updated successfully, but these errors were encountered: