ides_march (ides v0.4.2)

View Source

Kill graph analysis and restart logic for ides.

Summary

Functions

Return the PIDs of siblings that would be killed or restarted if TargetPid dies.

Return init analysis for the parent supervisor of Pid.

Return restart intensity information for a supervisor.

Return all PIDs that could cause TargetPid to be killed.

Return the kill graph with each entry tagged by its kill mechanism

Return link information for the given process.

Return monitor information for the given process.

Return whether a terminated child Pid would be restarted by its supervisor.

Types

exit_reason()

-type exit_reason() :: normal | abnormal.

Functions

affected_siblings(TargetPid)

-spec affected_siblings(TargetPid :: pid()) -> {ok, [pid()]} | {error, term()}.

Return the PIDs of siblings that would be killed or restarted if TargetPid dies.

Depends on the parent supervisor's strategy:

  • one_for_one: TargetPid only
  • one_for_all: all siblings
  • rest_for_one: TargetPid and all siblings after it
  • simple_one_for_one: TargetPid only

init_analysis(Pid)

-spec init_analysis(Pid :: pid()) -> {ok, ides_family:init_analysis_result()} | {error, term()}.

Return init analysis for the parent supervisor of Pid.

Walks the parent supervisor's children and computes a worst-case init failure assessment: how many children could fail init before exhausting the supervisor's restart intensity budget.

intensity_info(SupPid)

-spec intensity_info(SupPid :: pid()) -> {ok, ides_family:intensity_info()} | {error, term()}.

Return restart intensity information for a supervisor.

Reports the configured MaxR and MaxT policy, plus the current restart count and remaining budget if available from OTP state.

kill_graph(TargetPid)

-spec kill_graph(TargetPid :: pid()) -> {ok, [pid() | port() | {atom(), atom()}]} | {error, term()}.

Return all PIDs that could cause TargetPid to be killed.

This is the set of ancestors unioned with siblings that trigger cascade restarts under the parent supervisor's strategy:

  • one_for_one / simple_one_for_one: only ancestors (no sibling killers)
  • one_for_all: all siblings are killers
  • rest_for_one: siblings at positions before the target are killers

kill_graph_detail(TargetPid)

-spec kill_graph_detail(TargetPid :: pid()) -> {ok, [ides_family:kill_source()]} | {error, term()}.

Return the kill graph with each entry tagged by its kill mechanism:

  • ancestor — supervisor ancestor
  • sibling — sibling via supervisor strategy
  • link — linked process (relevant if target doesn't trap exits)
  • monitor — monitored process (relevant if target doesn't handle DOWN)

monitor_info(Pid)

-spec monitor_info(Pid :: pid()) -> {ok, ides_family:monitor_info()} | {error, term()}.

Return monitor information for the given process.

Reports which processes Pid is monitoring and which processes are monitoring Pid. Monitored processes are potential killers if Pid doesn't handle DOWN messages.

should_restart(Pid, Reason)

-spec should_restart(Pid :: pid(), Reason :: exit_reason()) -> boolean().

Return whether a terminated child Pid would be restarted by its supervisor.

Rules:

  • permanent: always restarted
  • transient: restarted only on abnormal exit
  • temporary: never restarted