-
Notifications
You must be signed in to change notification settings - Fork 45
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
Crash report after gun_open_failed #138
Comments
@dzimi This is a good point you make. An alternative I can think of to the current approach would be to add a new state called There could be a Do you have additional alternatives to these? We should probably take a look at how |
My first idea to resolve this problem was to create receive clause in 'open' function, something like this
In 'init' function try to open the connection and save result with pid of the client in state, return with {ok, State, 0}. Send asynchronous response in handle_info(timeout). This solution leaves current api unchanged. What do you think about it? |
I've forked your project and made a commit to fix this issue. Check out: dzimi@42995c4 What do you think about it? |
Ah! This explains why gun exits with 'normal' if gun:open fails, rather than actually providing a reasonable error value! If it's more valuable to prevent the crash reports than it is to distinguish between a failure to start due to gun:open timing out vs. gun:open encountering some other error, I'm fairly certain that However, we might be able to do both! Could we modify shotgun_sup and open(Host, Port, Type, Opts) ->
Ref = make_ref(),
RxTimeout = 5000, %This is just for illustration.
case supervisor:start_child(shotgun_sup, [Host, Port, Type, Opts, self(), Ref]) of
{error, normal} ->
receive {gun_open_error, Reason, Ref} ->
{error, Reason}
after RxTimeout
{error, normal}
end;
Ret -> Ret
end. What do you think of that? Is it too clever? |
Hi !
When I open a connection to not responding endpoint I've got gun_open_failed error which is ok. But I've also got an Crash Report of shotgun fsm, because fsm returned {stop, gun_open_failed} in the init function which is, at the end, called by shotgun_sup.
Will this behavior change?
For me crash report should occur when something unexpected happen and this case is quite common.
What is your opinion about that?
The text was updated successfully, but these errors were encountered: