Creating pprof diagnostic reports for Package Manager
This page provides a standard process to collect pprof profiling data when diagnosing performance or stability issues in Posit Package Manager (PPM).
We will request this information when:
Package Manager is being used and is experiencing:
- High CPU usage or unexplained resource consumption
- Application hangs, slowdowns, or suspected deadlocks
- Memory leaks or abnormal heap growth
What is pprof?
pprof is a Go profiling tool that can collect runtime information (such as goroutine stacks and heap usage) from running Go applications like PPM. PPM exposes pprof endpoints when debug mode is enabled.
Process
- Enable the Debug Endpoint
Add the following to your /etc/rstudio-pm/rstudio-pm.gcfg configuration file:
[Debug]
Listen = :3030This enables the pprof HTTP endpoint on port 3030. After editing the config, you must restart the PPM service with systemctl restart rstudio-pm.
If we only need stack traces, please add this instead:
[Debug]
Goroutines = false
Stacks = true
Listen = :3030However, the first option should give engineers all of the information they need - stacks and routines.
- Collecting
pprofData
Once PPM has restarted successfully, run these commands from the Package Manager system:
Using wget:
# Capture goroutine stack traces
wget "http://localhost:3030/debug/pprof/goroutine?debug=2" -O goroutine.txt
# Capture heap information
wget "http://localhost:3030/debug/pprof/heap?debug=1" -O heap.txtAlternatively, if curl is available:
curl -s http://localhost:3030/debug/pprof/goroutine > goroutine.out
curl -s http://localhost:3030/debug/pprof/heap > heap.outAttach both files to the support ticket you have already opened.
Security Note
The debug endpoint should only be enabled temporarily and should not be exposed to the public internet. For reference, it is unlikely that your IT team has port 3030 exposed to the internet, so it is unlikely that your PPM installation will be exposed in the time it takes to collect the report. This recommendation is included as best practice.
Remove or comment out the [Debug] section and restart PPM after collecting the data.
If you’re still having issues, you can reach out to Support by opening a ticket.