CredoHotUpgrades.Check.LocalReceiveLoop (CredoHotUpgrades v1.0.0)

Copy Markdown View Source

Basics

This check is disabled by default.

Learn how to enable it via .credo.exs.

This check has a base priority of high and works with any version of Elixir.

Explanation

The VM keeps two versions of a module, the current one and the old one, and a process executing old code stays there until it makes a fully qualified call. A process that loops by calling its own function without the module name stays on the version it started on forever:

defp loop(state) do
  receive do
    msg -> loop(handle(msg, state))   # never leaves the old code
  end
end

The old code does not stay for long, it is purged when the release is made permanent, and any process still running it is killed, blocking the next deploy. Call __MODULE__.loop(...) instead. A GenServer is fine, its loop belongs to the library.

Check-Specific Parameters

There are no specific parameters for this check.

General Parameters

Like with all checks, general params can be applied.

Parameters can be configured via the .credo.exs config file.