Fix: disable tracing when heap size limit is reached#972
Fix: disable tracing when heap size limit is reached#972
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR adds safeguards and UX feedback around the callback tracer to prevent excessive memory usage: it applies heap limits to tracer-related processes, detects when the dbg tracer dies, and surfaces a UI popup to let users re-enable tracing.
Changes:
- Add max heap size configuration for tracer processes and manage tracer restarts/disabled state via a new
DbgKilledevent. - Introduce a
TracingCrashPopuphook component and integrate it into key LiveViews to show when tracing has been disabled. - Refactor/adjust tests and dev tooling (memory repro LiveView, LiveDashboard route) to support the new behavior.
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| test/services/callback_tracer/gen_servers/tracing_manager_test.exs | Refactors setup expectations and updates refreshed-trace test flow. |
| test/services/callback_tracer/actions/tracing_test.exs | Updates tracer init argument expectations; removes refresh_tracing/0 tests. |
| mix.lock | Adds lock entries for LiveDashboard dependencies. |
| mix.exs | Adds phoenix_live_dashboard dependency for dev/test. |
| lib/live_debugger/utils/memory.ex | Adds helper to set :max_heap_size process flag in GB. |
| lib/live_debugger/services/callback_tracer/process/tracer.ex | Initializes heap limit for the :dbg.tracer process via an init-state wrapper. |
| lib/live_debugger/services/callback_tracer/gen_servers/tracing_manager.ex | Adds tracer_started?/0, restarts tracing on refresh, and broadcasts DbgKilled on tracer down. |
| lib/live_debugger/services/callback_tracer/gen_servers/trace_handler.ex | Applies heap limit, subscribes to bus events, and terminates on DbgKilled. |
| lib/live_debugger/services/callback_tracer/events.ex | Adds DbgKilled event definition. |
| lib/live_debugger/services/callback_tracer/actions/tracing.ex | Restarts tracer by stopping existing dbg + starting with init state wrapper; tightens refresh_tracing/1 guard. |
| lib/live_debugger/app/web/components/tracing_crash_popup.ex | New popup hook component to show tracing-disabled state and allow re-enable. |
| lib/live_debugger/app/web/components.ex | Hides popup close icon when no on_close is provided. |
| lib/live_debugger/app/settings/web/settings_live.ex | Integrates tracing crash popup into Settings LiveView. |
| lib/live_debugger/app/discovery/web/discovery_live.ex | Integrates tracing crash popup into Discovery LiveView. |
| lib/live_debugger/app/debugger/web/debugger_live.ex | Integrates tracing crash popup into Debugger LiveView; removes catch-all handle_info. |
| lib/live_debugger/app/debugger/callback_tracing/web/hooks/display_new_traces.ex | Makes trace streaming helpers nil-safe and uses is_trace/1 guard. |
| dev/router.ex | Adds routes for memory repro LiveView and LiveDashboard. |
| dev/live_views/memory_explosion.ex | New LiveView to reproduce memory-heavy behavior. |
| dev/layout.ex | Adds a client hook that auto-pushes tick events for the memory repro view. |
| dev/components.ex | Adds the new dev route to the dev navigation list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lib/live_debugger/services/callback_tracer/gen_servers/tracing_manager.ex
Show resolved
Hide resolved
lib/live_debugger/services/callback_tracer/gen_servers/tracing_manager.ex
Outdated
Show resolved
Hide resolved
lib/live_debugger/services/callback_tracer/gen_servers/tracing_manager.ex
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 20 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lib/live_debugger/services/callback_tracer/gen_servers/tracing_manager.ex
Show resolved
Hide resolved
lib/live_debugger/services/callback_tracer/gen_servers/tracing_manager.ex
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 20 out of 21 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 20 out of 21 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.