Skip to content

Commit

Permalink
Fix the issue with the timer on the runtime
Browse files Browse the repository at this point in the history
The problem was caused by hyperium/hyper#3567

Adding a timer to our server instance solved the problem and we can now
send requests to the router.

:)
  • Loading branch information
garypen committed Dec 5, 2024
1 parent c1d2536 commit ff1bf41
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
12 changes: 0 additions & 12 deletions apollo-router/src/axum_factory/axum_http_server_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,18 +300,6 @@ impl HttpServerFactory for AxumHttpServerFactory {
let actual_main_listen_address = main_listener
.local_addr()
.map_err(ApolloRouterError::ServerCreationError)?;
let mut http_config = Builder::new(TokioExecutor::new());
let mut h1_config = http_config.http1();
h1_config.keep_alive(true);
h1_config.header_read_timeout(Duration::from_secs(10));

if let Some(max_headers) = configuration.limits.http1_max_request_headers {
h1_config.max_headers(max_headers);
}

if let Some(max_buf_size) = configuration.limits.http1_max_request_buf_size {
h1_config.max_buf_size(max_buf_size.as_u64() as usize);
}

let (main_server, main_shutdown_sender) = serve_router_on_listen_addr(
main_listener,
Expand Down
4 changes: 4 additions & 0 deletions apollo-router/src/axum_factory/listeners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use futures::channel::oneshot;
use futures::prelude::*;
use hyper_util::rt::TokioExecutor;
use hyper_util::rt::TokioIo;
use hyper_util::rt::TokioTimer;
use hyper_util::server::conn::auto::Builder;
use multimap::MultiMap;
#[cfg(unix)]
Expand Down Expand Up @@ -275,6 +276,7 @@ pub(super) fn serve_router_on_listen_addr(
let mut http_connection = builder.http1();
let http_config = http_connection
.keep_alive(true)
.timer(TokioTimer::new())
.header_read_timeout(Duration::from_secs(10));
if let Some(max_headers) = opt_max_headers {
http_config.max_headers(max_headers);
Expand Down Expand Up @@ -319,6 +321,7 @@ pub(super) fn serve_router_on_listen_addr(
let mut http_connection = builder.http1();
let http_config = http_connection
.keep_alive(true)
.timer(TokioTimer::new())
.header_read_timeout(Duration::from_secs(10));
if let Some(max_headers) = opt_max_headers {
http_config.max_headers(max_headers);
Expand Down Expand Up @@ -373,6 +376,7 @@ pub(super) fn serve_router_on_listen_addr(
let mut http_connection = builder.http1();
let http_config = http_connection
.keep_alive(true)
.timer(TokioTimer::new())
.header_read_timeout(Duration::from_secs(10));
if let Some(max_headers) = opt_max_headers {
http_config.max_headers(max_headers);
Expand Down

0 comments on commit ff1bf41

Please sign in to comment.