Mix release "start_iex" shows error while "start" does not

Background

I am creating the release of an umbrella app via mix release. However, even though I can manually run the app, I get some errors when launching it.

mix release

I am trying to run an app with mix release. This command works fine and it creates the executable in _build/prod/rel/my_app/bin/my_app. I can run this executable with the command start and everything runs nicely.

However, if instead of start I use start_iex I first get an error, and then the app runs normally:

$ _build/prod/rel/my_app/bin/my_app start_iex
Erlang/OTP 22 [erts-10.5] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe]

*** ERROR: Shell process terminated! (^G to start new job) ***
Erlang/OTP 22 [erts-10.5] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe]

my_app is an umbrella app. Here is the mix.exs contents of the umbrella app:

defmodule MyApp.MixProject do
  use Mix.Project

  def project do
    [
      apps_path: "apps",
      version: "0.1.0",
      start_permanent: Mix.env() == :prod,
      deps: deps(),
      elixir: "~> 1.10",
      releases: releases()
    ]
  end

  defp deps, do: []

  defp releases, do:
    [
      my_app: [
        applications: [
          api: :permanent,
          core: :permanent,
          storage: :permanent
        ]
      ]
    ]
end

Question

  1. Why do I get an error when using start_iex and not when using start?
  2. Why does start_iex work after the error?

Turns out this issue is happening because of a bug.
According to this issue:

josevalim mentions this happens if you have shell history enabled (which I do).
There is no fix yet, but for those of you who wanted to know what was going on, you can now follow the ticket :smiley:

1 Like