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
start_iex
and not when using start
?start_iex
work after the error?This is a race condition when you have shell history enabled. There's an open report here.
Because the disk_log is started after the user process, there is a chance for race conditions on shutdown, where disk_log will terminate before group, which will fail to log.
Furthermore, if disk_log terminates BEFORE the shell starts, then the whole shell will fail to start, which will trigger another shell recursively, until the system finally shuts down. This can be reproduced with this command:
$ erl -kernel shell_history true -s init restart