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

[Waiting for modification] add conn idle timeout #2827

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

silence-coding
Copy link
Contributor

#2355
I'd like to ask if it's appropriate to carry out an idle check in these

@silence-coding silence-coding changed the title [WAIT] add conn idle timeout [Waiting for modification] add conn idle timeout May 6, 2022
@silence-coding silence-coding force-pushed the master branch 2 times, most recently from 77fc762 to d2545a2 Compare May 6, 2022 12:15
@silence-coding
Copy link
Contributor Author

This is only a demo to check whether there is a big problem in selecting the time point for connection timeout. I'll re-implement one later on, based on the community's recommendations.

@silence-coding
Copy link
Contributor Author

@paolobarbolini Do you have any good suggestions for me?

@deputinizer
Copy link

Spelling? Missing u

idle_timeot: Arc<Mutex<Pin<Box<Sleep>>>>

Also is changing Cargo.toml required?

log = "0.4.14"

And why not use:

if let Err(_) = timeout(Duration::from_secs(10), fut).await {
    println!("did not receive value within 10 seconds");
}

https://docs.rs/tokio/latest/tokio/time/fn.timeout.html
(im not very familiar with server part of hyper)

@silence-coding
Copy link
Contributor Author

Spelling? Missing u

idle_timeot: Arc<Mutex<Pin<Box<Sleep>>>>

Also is changing Cargo.toml required?

log = "0.4.14"

And why not use:

if let Err(_) = timeout(Duration::from_secs(10), fut).await {
    println!("did not receive value within 10 seconds");
}

https://docs.rs/tokio/latest/tokio/time/fn.timeout.html (im not very familiar with server part of hyper)

@deputinizer Thank you very much, and I'll take the time to submit a formal pull request later, with the corresponding tests and comments. This submission is my feasibility verification of this function, so I write it casually. My main concern is that there may be problems with this core implementation, especially for h2, resulting in a major rewrite of the submitted code.

@silence-coding
Copy link
Contributor Author

@deputinizer Can you tell me which line of code it is?

if let Err(_) = timeout(Duration::from_secs(10), fut).await {
    println!("did not receive value within 10 seconds");
}

Dav1dde added a commit to getsentry/relay that referenced this pull request Nov 14, 2024
With the idle time configurable we can prevent a pile up of open
connections which never see any activity.

See also on the hyper issue tracker:
```
hyperium/hyper#3743
hyperium/hyper#1628
hyperium/hyper#2355
hyperium/hyper#2827
```
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.

2 participants