{"record":{"id":"73c74088b2450d0b","repo":"databendlabs/databend","slug":"e-73c740","errorCode":null,"errorMessage":"{e}","messagePattern":"\\{e\\}","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"src/common/http/src/debug/jeprof.rs","lineNumber":36,"sourceCode":"use poem::Error;\nuse poem::error::InternalServerError;\nuse poem::web::IntoResponse;\nuse poem::web::Query;\nuse tempfile::Builder;\n\n#[poem::handler]\npub async fn debug_jeprof_dump_handler(\n    _req: Option<Query<String>>,\n) -> poem::Result<impl IntoResponse> {\n    let tmp_file = Builder::new()\n        .prefix(\"heap_dump_\")\n        .suffix(\".prof\")\n        .tempfile()\n        .map_err(InternalServerError)?;\n\n    let path = tmp_file.path();\n    let body = dump_profile(&path.to_string_lossy()).map_err(|e| {\n        Error::new(\n            ErrorCode::from(e.to_string().as_str()),\n            StatusCode::INTERNAL_SERVER_ERROR,\n        )\n    })?;\n    let body_len = body.len();\n\n    Ok(body.with_header(\"content-length\", body_len).with_header(\n        \"Content-Disposition\",\n        format!(\"attachment; filename=\\\"{}\\\"\", &path.to_string_lossy()),\n    ))\n}\n","sourceCodeStart":18,"sourceCodeEnd":48,"githubUrl":"https://github.com/databendlabs/databend/blob/288d84d76e20a2f8f7173bda9691eb6ece301aa9/src/common/http/src/debug/jeprof.rs#L18-L48","documentation":"The jeprof debug dump HTTP handler converts any error returned by dump_profile into an internal-server Error whose message is the underlying error's Display output (\"{e}\") with a 500 status. It signals that collecting/writing the jemalloc profile (jeprof) failed on the server side.","triggerScenarios":"Calling the debug jeprof dump endpoint when dump_profile fails — e.g. the temporary .prof file cannot be used, the jeprof binary is missing, or the profile dump command exits non-zero.","commonSituations":"Profiling a deployment where jemalloc profiling is disabled at build/runtime, jeprof/perf tooling absent in the container image, or the temp directory is not writable.","solutions":["Inspect the interpolated message {e} to see the underlying dump_profile failure cause.","Verify jeprof and required tooling are installed in the image and jemalloc profiling is enabled.","Ensure the temp directory (where the .prof tempfile is created) is writable.","Re-run the dump endpoint after fixing the environment; if the cause is code-level, open an issue with the full error string."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match resp.status() {\n    StatusCode::OK => parse_profile(resp),\n    status => log::error!(\"jeprof dump failed: {}\", resp.text().unwrap_or_default()),\n}","preventionTips":["Verify jeprof/perf tooling is present in the deployment image before profiling.","Ensure the temp directory is writable in containers.","Read the returned error body for the underlying dump_profile cause."],"tags":["http","profiling","rust","internal-server-error"],"backgroundTag":"http-error-response","analyzedSha":"288d84d76e20a2f8f7173bda9691eb6ece301aa9","analyzedAt":"2026-09-11T11:29:36.208Z","contentChangedAt":"2026-09-11T11:29:36.208Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}