influxdata/influxdb · error · HeapDumpError::ProfilingDisabled
heap profiling is disabled; restart with
Error message
heap profiling is disabled; restart with {MALLOC_CONF_ENV}=prof:true to enable What it means
HeapDumpError::ProfilingDisabled is returned by dump_heap_profile when jemalloc's heap profiling feature (prof) is not active in the running process. The crate requires the process to have been started with the MALLOC_CONF environment containing prof:true; without it jemalloc cannot produce heap_v2 profile dumps. This is a configuration/runtime-startup condition, not a runtime fault.
Solutions
- Restart the process with MALLOC_CONF=prof:true (combined with any other needed options) as the error message instructs
- Verify with `MALLOC_CONF=print:true` or by checking the endpoint that profiling is enabled after restart
- If profiling is too costly in prod, keep it enabled only in staging/debug deployments
Example fix
// before ./myapp // after MALLOC_CONF=prof:true ./myapp
Defensive patterns
Strategy: validation
Validate before calling
fn profiling_enabled() -> bool {
std::env::var("MALLOC_CONF").map(|v| v.split(',').any(|o| o == "prof:true")).unwrap_or(false)
}
if !profiling_enabled() { return Err("start with MALLOC_CONF=prof:true"); } Try / catch
match dump_heap_profile().await {
Err(HeapDumpError::ProfilingDisabled) => HttpResponse::new(StatusCode::PRECONDITION_FAILED, "enable MALLOC_CONF=prof:true"),
other => other?,
} Prevention
- Set MALLOC_CONF=prof:true in the service's deployment manifest
- Document the env requirement next to the pprof endpoint
- Check profiling is active at startup and log a warning if not
When it happens
Trigger: Calling dump_heap_profile() (or hitting the pprof heap endpoint) in a process launched without MALLOC_CONF=prof:true — for example a service started with default env or a MALLOC_CONF that lacks the prof option.
Common situations: Deploying the binary without the jemalloc profiling env var; enabling the pprof HTTP endpoint but forgetting the restart flag; MALLOC_CONF overwritten by another profiling config (e.g. only abort_conf or background_thread set).
Related errors
- jemalloc prof.dump failed
- tempfile path was not valid C string (non-utf8 or interior…
- An unexpected error occurred in the client library
- blocking task join
- Cannot parse object store config
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/eca174f089047e35.
Report an issue: GitHub.
Appendix: source
Thrown at core/jemalloc_stats/src/lib.rs:94
/// in a user-facing message differs by build target.
pub const MALLOC_CONF_ENV: &str = if cfg!(any(
target_os = "macos",
target_os = "ios",
target_os = "android",
target_os = "dragonfly",
target_env = "musl",
)) {
"_RJEM_MALLOC_CONF"
} else {
"MALLOC_CONF"
};
/// Errors returned by [`dump_heap_profile`].
#[derive(Debug, thiserror::Error)]
pub enum HeapDumpError {
#[error("tempfile path was not valid C string (non-utf8 or interior NUL)")]
BadTempPath,
#[error("heap profiling is disabled; restart with {MALLOC_CONF_ENV}=prof:true to enable")]
ProfilingDisabled,
#[error("jemalloc prof.dump failed: {0}")]
Jemalloc(#[from] tikv_jemalloc_ctl::Error),
#[error("tempfile i/o: {0}")]
Io(#[from] std::io::Error),
#[error("blocking task join: {0}")]
Join(#[from] tokio::task::JoinError),
}
/// Trigger a jemalloc heap profile dump and return a streaming reader for
/// the resulting `heap_v2` bytes.
///
/// Requires jemalloc built with `--enable-prof` (i.e. `tikv-jemallocator`
/// `profiling` feature) AND the binary started with `prof:true` in the
/// platform-appropriate `MALLOC_CONF` env var (or via a baked-in
/// `malloc_conf` static — see [`DEFAULT_MALLOC_CONF`]). When profiling is
/// disabled at startup this returns [`HeapDumpError::ProfilingDisabled`].
///View on GitHub (pinned to 06200ef96b)