File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ use runner_shared::fifo::Command as FifoCommand;
1818use runner_shared:: fifo:: IntegrationMode ;
1919use std:: path:: Path ;
2020use std:: rc:: Rc ;
21+ use tokio:: time:: { Duration , timeout} ;
2122
2223const MEMTRACK_COMMAND : & str = "codspeed-memtrack" ;
2324const MEMTRACK_CODSPEED_VERSION : & str = "1.0.0" ;
@@ -120,7 +121,16 @@ impl MemoryExecutor {
120121 debug ! ( "handle_fifo called with PID {pid}" ) ;
121122
122123 // Accept the IPC connection from memtrack and get the sender it sends us
123- let ( _, memtrack_sender) = ipc. accept ( ) ?;
124+ // Use a timeout to prevent hanging if the process doesn't start properly
125+ // https://github.com/servo/ipc-channel/issues/261
126+ let ( _, memtrack_sender) = timeout ( Duration :: from_secs ( 5 ) , async move {
127+ tokio:: task:: spawn_blocking ( move || ipc. accept ( ) )
128+ . await
129+ . context ( "Failed to spawn blocking task" ) ?
130+ . context ( "Failed to accept IPC connection" )
131+ } )
132+ . await
133+ . context ( "Timeout waiting for IPC connection from memtrack process" ) ??;
124134 let ipc_client = Rc :: new ( MemtrackIpcClient :: from_accepted ( memtrack_sender) ) ;
125135
126136 let ipc_client_health = Rc :: clone ( & ipc_client) ;
You can’t perform that action at this time.
0 commit comments