-
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
Merged
Merged
improve robustness #182
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
fedea1f
fix: adjust esockd_acceptor restart intensity and period
qzhuyan 526a8e5
fix: listener handle port close
qzhuyan ce22d1a
test: listener handle port close
qzhuyan 8630063
test: update test for ports close
qzhuyan 87640ea
fix(acceptor): don't close listening socket in terminate
qzhuyan af38485
ci: coverall only when success
qzhuyan 455a93b
ci: move coveralls to seprate job
qzhuyan 40356b1
fix: ensure counters when listener restarts by sup
qzhuyan cbf63b5
fix: handle econnaborted return from async_accept
qzhuyan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,9 +134,12 @@ handle_event(internal, begin_waiting, waiting, State = #state{lsock = LSock}) -> | |
Reason =:= enfile | ||
-> | ||
{next_state, suspending, State, {state_timeout, 1000, begin_waiting}}; | ||
{error, econnaborted} -> | ||
{next_state, waiting, State, {next_event, internal, begin_waiting}}; | ||
{error, closed} -> | ||
{stop, normal, State}; | ||
{error, Reason} -> | ||
error_logger:error_msg("~p async_accept error: ~p", [?MODULE, Reason]), | ||
{stop, Reason, State} | ||
end; | ||
handle_event( | ||
|
@@ -210,8 +213,11 @@ 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 commentThe 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. |
||
terminate(normal, _StateName, #state{}) -> | ||
ok; | ||
terminate(Reason, _StateName, #state{}) -> | ||
error_logger:error_msg("~p terminating due to ~p", [?MODULE, Reason]), | ||
ok. | ||
|
||
code_change(_OldVsn, StateName, State, _Extra) -> | ||
{ok, StateName, State}. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.