influxdata/influxdb · error · HeapDumpError
jemalloc prof.dump failed
Error message
jemalloc prof.dump failed: {0} What it means
HeapDumpError::Jemalloc wraps a tikv_jemalloc_ctl::Error raised when the prof.dump mallctl call fails during dump_heap_profile. The tempfile was created successfully, but asking jemalloc to write the heap profile into it returned an error from the allocator control API. The original control error is preserved via #[from] for diagnosis.
Solutions
- Inspect the wrapped tikv_jemalloc_ctl::Error via Display/source to see the mallctl failure
- Confirm the linked jemalloc was built with profiling support (--enable-prof) and that MALLOC_CONF=prof:true was actually applied
- Check temp-dir permissions and free space; retry the dump once conditions are fixed
Example fix
// before
let stream = dump_heap_profile().await?; // opaque failure
// after
match dump_heap_profile().await {
Ok(s) => /* ... */,
Err(HeapDumpError::Jemalloc(e)) => tracing::error!(%e, "jemalloc mallctl failed"),
Err(e) => return Err(e.into()),
} Defensive patterns
Strategy: try-catch
Try / catch
match dump_heap_profile().await {
Err(HeapDumpError::Jemalloc(e)) => { tracing::error!(%e, "prof.dump failed"); /* inspect source chain */ }
other => other?,
} Prevention
- Verify the linked jemalloc is built with --enable-prof
- Keep temp dirs writable with free space
- Avoid racing concurrent heap dumps
When it happens
Trigger: Calling dump_heap_profile() when the underlying jemalloc prof.dump mallctl rejects the write: profiling option mismatches at runtime, dump target permission issues inside the temp dir, or a jemalloc built without the profiling feature despite the env flag.
Common situations: A jemalloc build (e.g. system jemalloc compiled without --enable-prof) that ignores prof:true; disk full or permission problems in the temp directory; concurrent dumps racing on the same target.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- heap profiling is disabled; restart with
- tempfile path was not valid C string (non-utf8 or interior…
- blocking task join
- tempfile i/o
- is not a valid data type, values are int64, uint64…
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/fb14bc0ebd1de5fc.
Report an issue: GitHub.
Appendix: source
Thrown at core/jemalloc_stats/src/lib.rs:96
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`].
///
/// The function handles all file machinery internally: it allocates a
/// tempfile, runs jemalloc's synchronous `prof.dump`, unlinks the path, andView on GitHub (pinned to 06200ef96b)