Skip to content

Fix memory profiling #835

@Flyangz

Description

@Flyangz

Describe the bug
Currently, when enable jemalloc-pprof feature, and request /debug/memory/profile to get memory profile, we will get the following error message.

thread 'tokio-runtime-worker' panicked at native-engine/blaze/src/http/memory_profiling.rs:31:58:
called `Option::unwrap()` on a `None` value

To Reproduce

  1. Applying the patch from fix http server startup #834.
  2. Using the test code in Http Service Fail to Start #833.
  3. Running cargo test --features jemalloc-pprof --package blaze --lib http::test::test_http_service -- --exact --nocapture under blaze/native-engine/blaze
  4. curl the corresponding url: http://localhost:xxxx/debug/memory/profile

Expected behavior
Dump memory profile successfully.

Additional context
After debugging, I found we lack the malloc_conf to enable jemalloc_pprof.
https://github.com/polarsignals/rust-jemalloc-pprof/blob/00cdef93bb4b761d5790e0be1a97f7c33ea04dda/README.md?plain=1#L33-L43
https://github.com/polarsignals/rust-jemalloc-pprof/blob/00cdef93bb4b761d5790e0be1a97f7c33ea04dda/src/lib.rs#L90

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions