phoenixframework / phoenix_live_dashboard

Realtime dashboard with metrics, request logging, plus storage, OS and VM insights

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bad RPC call on first launch after adding `:os_mon`

halostatue opened this issue · comments

Environment

Make sure you are using the latest LiveView and Dashboard versions before continuing.

This is on a freshly created Phoenix application mix phx.new. The only trick is that I’m using an umbrella setup, but I do not think that will change the error.

  • Elixir version (elixir -v):

    Erlang/OTP 26 [erts-14.1.1] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]
    
    Elixir 1.15.7 (compiled with Erlang/OTP 26)
    
  • Phoenix version (mix deps): phoenix 1.7.10 (Hex package) (mix)

  • Phoenix LiveView version (mix deps): phoenix_live_view 0.20.2 (Hex package) (mix)

  • Phoenix Dashboard version (mix deps): phoenix_live_dashboard 0.8.3 (Hex package) (mix)

  • Operating system: macOS 13.6.3 22G436 arm64

  • Browsers you attempted to reproduce this bug on (the more the merrier): n/a, but Safari

Actual behavior

  1. iex -S mix phx.server; visit live dashboard: OS is not enabled (expected).
  2. Quit iex. Edit the base mix.exs (in an umbrella this would be apps/main_app/mix.exs to add :os_mon to extra_applications.
  3. iex -S mix phx.server; visit live dashboard. OS is enabled (expected). Click on it produces the crash below.
  4. Quit iex.
  5. iex -S mix phx.server; visit live dashboard. OS is enabled and does not crash.
key :system_mem not found…
key :system_mem not found in: {:badrpc,
 {:EXIT,
  {:undef,
   [
     {:cpu_sup, :util, [[:detailed, :per_cpu]], []},
     {Phoenix.LiveDashboard.SystemInfo, :os_mon_callback, 0,
      [file: ~c"lib/phoenix/live_dashboard/system_info.ex", line: 726]}
   ]}}}

Expected behavior

Not a process crash. It seems odd that this is failing this way — but it is reliably failing this way.

By reliably failing, I mean that I have been able to reproduce it 5–6 times in a row. Remove :os_mon, restart (disabled). Add :os_mon, restart (enabled, crash), restart (enabled, no crash). Rinse and repeat.