Skip to content

Commit

Permalink
[Trivial] Extend driver shutdown time (#2726)
Browse files Browse the repository at this point in the history
# Description
We have been seeing panics like
[this](https://cowservices.slack.com/archives/C037PB929ME/p1715586375609859)
sporadically on system restarts.

I believe the root-cause for this is that the time we leave the driver
to gracefully shut down (10s) is shorter than the time a single solve
request may be taking. This when a solve request is in flight, we don't
wait long enough before forcing shutdown. Timeline from the example ☝️

- 2024-05-13T07:45:28.781Z driver competition started
- 2024-05-13T07:45:30.313Z likely receipt of shutdown signal (no logs)
- 2024-05-13T07:45:40.313Z panic due to timeout
- 2024-05-13T07:45:43.254Z driver competition deadline would have been
reached

# Changes
- [x] Wait 20s for timeout
- [x] Log when shutdown signal is received

## How to test
CI and hope to no longer see those panics.
  • Loading branch information
fleupold authored May 13, 2024
1 parent 78dd28c commit 0642920
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/driver/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ async fn run_with(args: cli::Args, addr_sender: Option<oneshot::Sender<SocketAdd
tokio::select! {
result = &mut serve => panic!("serve task exited: {result:?}"),
_ = shutdown_signal() => {
tracing::info!("Gracefully shutting down API");
shutdown_sender.send(()).expect("failed to send shutdown signal");
match tokio::time::timeout(Duration::from_secs(10), serve).await {
// Shutdown timeout needs to be larger than the auction deadline
match tokio::time::timeout(Duration::from_secs(20), serve).await {
Ok(inner) => inner.expect("API failed during shutdown"),
Err(_) => panic!("API shutdown exceeded timeout"),
}
Expand Down

0 comments on commit 0642920

Please sign in to comment.