-
Notifications
You must be signed in to change notification settings - Fork 84
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
improve robustness #182
improve robustness #182
Conversation
overall, it looks like this
|
4b4127f
to
43af862
Compare
@@ -210,8 +211,9 @@ handle_event(Type, Content, StateName, _) -> | |||
), | |||
keep_state_and_data. | |||
|
|||
terminate(_Reason, _StateName, #state{lsock = LSock}) -> | |||
close(LSock). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove it because I don't want to spread errors to the entire sup tree.
7750b3e
to
9b0f0fc
Compare
If we cannot bet on retry, then close socket + stop |
This comment provided some hint on the cause: It seems people treat |
as it spreads error to the whole sup tree
3380bb9
to
cbf63b5
Compare
{error, closed} -> | ||
{stop, normal, State}; | ||
{error, Reason} -> | ||
error_logger:error_msg("~p async_accept error: ~p", [?MODULE, Reason]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
close the socket before stop ?
so the listener process will for sure get an EXIT signal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just record after discussion:
We don't need to close the listen port here to avoid spreading the error to the other acceptors (where other acceptors will get closed error) since we don't know if the error is from the Listen port or some other unknown posix errors.
AND we have a listener process that handles the EXIT signal from the listen port.
AND we trust OTP will trigger port signals if listen port is unusable, unacceptable.
AND we checked that inet_tcp:accept
does not close the port when it gets an error, thus we follow it.
No description provided.