tikv/tikv · error
panic!()
Error message
panic!()
What it means
PanicReporter::new is an intentional `panic!()`: the StatisticsReporter implementation for PanicEngine cannot produce a real reporter because there is no engine statistics to attach to. Constructing it via `StatisticsReporter::new(name)` for a PanicEngine always aborts.
Source
Thrown at components/engine_panic/src/misc.rs:13
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0.
use engine_traits::{
DeleteStrategy, MiscExt, Range, RangeStats, Result, StatisticsReporter, WriteOptions,
};
use crate::engine::PanicEngine;
pub struct PanicReporter;
impl StatisticsReporter<PanicEngine> for PanicReporter {
fn new(name: &str) -> Self {
panic!()
}
fn collect(&mut self, engine: &PanicEngine) {
panic!()
}
fn flush(&mut self) {
panic!()
}
}
impl MiscExt for PanicEngine {
type StatisticsReporter = PanicReporter;
fn flush_cfs(&self, cfs: &[&str], wait: bool) -> Result<()> {
panic!()
}
View on GitHub (pinned to 78aedc1c81)
Solutions
- Start with a real engine (engine_rocks) so the real reporter is constructed
- Gate reporter construction on engine type and skip it for PanicEngine
- In tests, provide a mock StatisticsReporter instead of relying on PanicEngine's
Example fix
// before
let mut reporter = <PanicEngine as MiscExt>::StatisticsReporter::new("tikv");
// after
if engine.is_panic() { return; } // skip stats reporting
let mut reporter = <PanicEngine as MiscExt>::StatisticsReporter::new("tikv"); Defensive patterns
Strategy: validation
Validate before calling
if engine.is_panic() { return; } // do not construct a statistics reporter
let reporter = <PanicEngine as MiscExt>::StatisticsReporter::new("tikv"); Type guard
fn is_panic_engine(e: &dyn Engine) -> bool { e.as_any().is::<PanicEngine>() } Prevention
- Construct the statistics reporter only for real engines
- Provide a no-op StatisticsReporter for panic-engine test builds
- Add a startup check rejecting panic-engine configs in production
When it happens
Trigger: Calling `PanicReporter::new(name)` / `<<PanicEngine as MiscExt>::StatisticsReporter>::new(...)` on the panic engine, e.g. from a statistics-reporting thread or server startup path.
Common situations: Starting a TiKV node or a test harness with the panic engine while the statistics reporter is instantiated unconditionally at startup.
Related errors
AI-assisted analysis of tikv/tikv@78aedc1c81 (2026-09-03).
Data as JSON: /api/errors/6844a5abea22b63f.
Report an issue: GitHub.