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

tls-rustls-reload example not reloading periodically #809

Open
Tracked by #745
mixaal opened this issue Jun 11, 2024 · 1 comment
Open
Tracked by #745

tls-rustls-reload example not reloading periodically #809

mixaal opened this issue Jun 11, 2024 · 1 comment

Comments

@mixaal
Copy link

mixaal commented Jun 11, 2024

Describe the bug

the tls-rustls-reload loads the certificates just once at the startup, it never re-attempts to go thru the loop inside the async stream again.

To Reproduce

This little code change makes it more clear, set the reloading duration to 1sec and put some debug messages around. The messages are seen only once as the sleep await is never woke up.

diff --git a/examples/tls-rustls-reload/src/main.rs b/examples/tls-rustls-reload/src/main.rs
index e7fe77bc..deda2a30 100644
--- a/examples/tls-rustls-reload/src/main.rs
+++ b/examples/tls-rustls-reload/src/main.rs
@@ -15,8 +15,10 @@ async fn main() {
     let acceptor = TcpListener::new("0.0.0.0:5800")
         .rustls(async_stream::stream! {
             loop {
+                tracing::info!("loading config...");
                 yield load_config();
-                tokio::time::sleep(Duration::from_secs(60)).await;
+                tracing::info!("sleeping...");
+                tokio::time::sleep(Duration::from_secs(1)).await;
             }
         })
         .bind()

Expected behavior
I assume we want to see messages to appear every 1s tick.

Screenshots

Desktop (please complete the following information):

OS: Ubuntu 23.10

uname -a
Linux smurf 6.5.0-35-generic #35-Ubuntu SMP PREEMPT_DYNAMIC Fri Apr 26 11:23:57 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

rustc version:

rustc --version
rustc 1.76.0 (07dca489a 2024-02-04)
@mixaal
Copy link
Author

mixaal commented Jun 11, 2024

Apparently the tls is reloaded when the server is in use, e.g. by issuing curl on the / endpoint. So maybe it's expected behavior but might be noted in the doc.

@chrislearn chrislearn mentioned this issue Aug 22, 2024
7 tasks
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

No branches or pull requests

1 participant