Skip to content
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

fix: add transport connection number limit on listener #200

Merged
merged 1 commit into from
Nov 27, 2019

Conversation

driftluo
Copy link
Collaborator

Tentacle has not previously made any restrictions on the number of transport connections, which may lead to fd attacks. The good news is that the consequence of the fd attack is only that the listening service will be closed, and it will not affect the established connection. But we should fix it.

The fd create on std::sys::net, and it will call by tokio::tcplistener::poll_accpet, their calling relationship is as follows:

tokio -> mio -> std net -> std sys common -> std sys net -> std sys fd -> syscall

@driftluo driftluo requested review from doitian and a team November 26, 2019 06:19
src/service.rs Outdated Show resolved Hide resolved
@@ -1503,6 +1503,17 @@ where
/// Poll listen connections
#[inline]
fn listen_poll(&mut self) {
if !self
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How the system restores and this condition becomes false?

Copy link
Collaborator Author

@driftluo driftluo Nov 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some session shutdown it will become true, the total number of working session is calculated dynamically

@driftluo driftluo merged commit 045c439 into master Nov 27, 2019
@driftluo driftluo deleted the add-fd-limit branch November 27, 2019 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants