File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ use runner_shared::fifo::IntegrationMode;
2222use std:: path:: Path ;
2323use std:: rc:: Rc ;
2424use tempfile:: NamedTempFile ;
25+ use tokio:: time:: { Duration , timeout} ;
2526
2627const MEMTRACK_COMMAND : & str = "codspeed-memtrack" ;
2728const MEMTRACK_CODSPEED_VERSION : & str = "1.0.0" ;
@@ -130,7 +131,16 @@ impl MemoryExecutor {
130131 debug ! ( "handle_fifo called with PID {pid}" ) ;
131132
132133 // Accept the IPC connection from memtrack and get the sender it sends us
133- let ( _, memtrack_sender) = ipc. accept ( ) ?;
134+ // Use a timeout to prevent hanging if the process doesn't start properly
135+ // https://github.com/servo/ipc-channel/issues/261
136+ let ( _, memtrack_sender) = timeout ( Duration :: from_secs ( 5 ) , async move {
137+ tokio:: task:: spawn_blocking ( move || ipc. accept ( ) )
138+ . await
139+ . context ( "Failed to spawn blocking task" ) ?
140+ . context ( "Failed to accept IPC connection" )
141+ } )
142+ . await
143+ . context ( "Timeout waiting for IPC connection from memtrack process" ) ??;
134144 let ipc_client = Rc :: new ( MemtrackIpcClient :: from_accepted ( memtrack_sender) ) ;
135145
136146 let ipc_client_health = Rc :: clone ( & ipc_client) ;
You can’t perform that action at this time.
0 commit comments