Skip to content

[Waiting for modification] add conn idle timeout#2827

Open
silence-coding wants to merge 1 commit into
hyperium:masterfrom
silence-coding:master
Open

[Waiting for modification] add conn idle timeout#2827
silence-coding wants to merge 1 commit into
hyperium:masterfrom
silence-coding:master

Conversation

@silence-coding

Copy link
Copy Markdown
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 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
Copy Markdown
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
Copy Markdown
Contributor Author

@paolobarbolini Do you have any good suggestions for me?

@deputinizer

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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

2 participants