File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,13 @@ ENTRYPOINT [ "solvers" ]
6060
6161# Extract Binary
6262FROM intermediate
63+
64+ # Configure jemalloc profiling (only affects services built with jemalloc-profiling feature)
65+ # prof:true - Enable profiling
66+ # prof_active:true - Start profiling immediately
67+ # lg_prof_sample:19 - Sample every 2^19 bytes (~524KB)
68+ ENV MALLOC_CONF="prof:true,prof_active:true,lg_prof_sample:19"
69+
6370RUN apt-get update && \
6471 apt-get install -y build-essential cmake git zlib1g-dev libelf-dev libdw-dev libboost-dev libboost-iostreams-dev libboost-program-options-dev libboost-system-dev libboost-filesystem-dev libunwind-dev libzstd-dev git netcat-openbsd
6572RUN git clone https://invent.kde.org/sdk/heaptrack.git /heaptrack && \
Original file line number Diff line number Diff line change @@ -89,12 +89,17 @@ async fn generate_and_stream_dump(socket: &mut UnixStream) {
8989 tracing:: info!( "generating heap dump via jemalloc_pprof" ) ;
9090
9191 // Access the global profiling controller
92- let prof_ctl = match jemalloc_pprof:: PROF_CTL . as_ref ( ) {
93- Some ( ctl) => ctl,
94- None => {
92+ // Catch panic if jemalloc profiling is not available
93+ let prof_ctl = match std:: panic:: catch_unwind ( || jemalloc_pprof:: PROF_CTL . as_ref ( ) ) {
94+ Ok ( Some ( ctl) ) => ctl,
95+ Ok ( None ) => {
9596 tracing:: error!( "jemalloc profiling not initialized" ) ;
9697 return ;
9798 }
99+ Err ( _) => {
100+ tracing:: error!( "jemalloc profiling not available - service not built with jemalloc-profiling feature or allocator not configured" ) ;
101+ return ;
102+ }
98103 } ;
99104
100105 let mut prof_ctl = prof_ctl. lock ( ) . await ;
You can’t perform that action at this time.
0 commit comments