{"record":{"id":"83546ed5b1f40814","repo":"databendlabs/databend","slug":"error-83546e","errorCode":null,"errorMessage":"{}","messagePattern":"\\{\\}","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/query/service/src/table_functions/sync_crash_me.rs","lineNumber":159,"sourceCode":"}\n\nimpl SyncCrashMeSource {\n    pub fn create(\n        scan: Arc<Progress>,\n        output: Arc<OutputPort>,\n        message: Option<String>,\n    ) -> Result<ProcessorPtr> {\n        SyncSourcer::create(scan, output, SyncCrashMeSource { message })\n    }\n}\n\nimpl SyncSource for SyncCrashMeSource {\n    const NAME: &'static str = \"sync_crash_me\";\n\n    fn generate(&mut self) -> Result<Option<DataBlock>> {\n        match &self.message {\n            None => panic!(\"sync crash me panic\"),\n            Some(message) => panic!(\"{}\", message),\n        }\n    }\n}\n\nimpl TableFunction for SyncCrashMeTable {\n    fn function_name(&self) -> &str {\n        self.name()\n    }\n\n    fn as_table<'a>(self: Arc<Self>) -> Arc<dyn Table + 'a>\n    where Self: 'a {\n        self\n    }\n}\n","sourceCodeStart":141,"sourceCodeEnd":174,"githubUrl":"https://github.com/databendlabs/databend/blob/288d84d76e20a2f8f7173bda9691eb6ece301aa9/src/query/service/src/table_functions/sync_crash_me.rs#L141-L174","documentation":"This is not a real failure but a deliberate testing hook: the `sync_crash_me` table function panics with a caller-supplied message (or a fixed message if none was given) when its `generate` method is invoked. It exists so tests can verify that the query engine survives a panic inside a table function source without corrupting the session.","triggerScenarios":"Executing the `sync_crash_me` table function (e.g. `SELECT * FROM sync_crash_me('my message')`); the panic fires on the first `generate()` call with the user-provided message string.","commonSituations":"Developers running crash-recovery or fault-injection tests, verifying panic propagation across the async executor boundary, or accidentally invoking the test table function in a production-like environment.","solutions":["If hit accidentally, simply stop using the `sync_crash_me` table function — it always panics by design.","Ensure the message argument is a plain string if you need a recognizable panic message in tests.","For production, guard the table function behind test-only builds/feature flags so it cannot be registered."],"exampleFix":"// before: table function registered unconditionally\nregister_table_function(SyncCrashMeTable::create);\n// after: register only in debug/test builds\n#[cfg(any(debug_assertions, test))]\nregister_table_function(SyncCrashMeTable::create);","handlingStrategy":"try-catch","validationCode":"// Before invoking, check the table function is the test hook\nif table_function_name == \"sync_crash_me\" {\n    // do not run in production paths\n    return Err(\"sync_crash_me is a fault-injection test function\");\n}","typeGuard":"fn is_crash_me_function(name: &str) -> bool { name == \"sync_crash_me\" }","tryCatchPattern":"// The panic propagates as a task failure in the async executor; catch at the pipeline boundary\nmatch pipeline_result {\n    Err(err) if err.message().contains(\"sync crash me\") => {\n        log::warn!(\"expected fault injection: {}\", err);\n        // treat as expected failure in tests\n    }\n    other => other?,\n}","preventionTips":["Never reference sync_crash_me outside of dedicated fault-injection tests.","Restrict registration of test-only table functions to debug builds.","When writing crash tests, assert on the panic message so unrelated panics are not masked."],"tags":["rust","panic","testing","fault-injection","table-function"],"backgroundTag":"internal-invariant-violation","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"}