mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-17 22:07:47 +00:00
Log source file on compile timeout (#10672)
Log the file that failed to bytecode compile when encountering a timeout for debugging #6105 better. [sysinfo](https://lib.rs/crates/sysinfo) would give us the option to report memory usage too, but i'm hesitant to add a dependency just for the error path.
This commit is contained in:
parent
b46c6db317
commit
8b1d3de4fc
1 changed files with 9 additions and 3 deletions
|
@ -48,8 +48,11 @@ pub enum CompileError {
|
|||
#[source]
|
||||
err: Box<Self>,
|
||||
},
|
||||
#[error("Bytecode timed out ({}s)", _0.as_secs_f32())]
|
||||
CompileTimeout(Duration),
|
||||
#[error("Bytecode timed out ({}s) compiling file: `{}`", elapsed.as_secs_f32(), source_file)]
|
||||
CompileTimeout {
|
||||
elapsed: Duration,
|
||||
source_file: String,
|
||||
},
|
||||
#[error("Python startup timed out ({}s)", _0.as_secs_f32())]
|
||||
StartupTimeout(Duration),
|
||||
}
|
||||
|
@ -358,7 +361,10 @@ async fn worker_main_loop(
|
|||
// should ever take.
|
||||
tokio::time::timeout(COMPILE_TIMEOUT, python_handle)
|
||||
.await
|
||||
.map_err(|_| CompileError::CompileTimeout(COMPILE_TIMEOUT))??;
|
||||
.map_err(|_| CompileError::CompileTimeout {
|
||||
elapsed: COMPILE_TIMEOUT,
|
||||
source_file: source_file.clone(),
|
||||
})??;
|
||||
|
||||
// This is a sanity check, if we don't get the path back something has gone wrong, e.g.
|
||||
// we're not actually running a python interpreter.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue