混合发行版“ start_iex”显示错误,而“ start”没有

问题描述

背景

我正在通过mix release创建一个发布应用程序。但是,即使我可以手动运行该应用程序,在启动它时也会遇到一些错误

mix release

我正在尝试使用mix release运行一个应用程序。该命令可以正常工作,并在_build/prod/rel/my_app/bin/my_app中创建可执行文件。我可以使用命令start运行此可执行文件,一切运行良好。

但是,如果我不是使用start而是使用start_iex而不是$ _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

mix.exs一个伞形应用。以下是伞形应用程序的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

问题

  1. 为什么使用start而不是start_iex时会出错?
  2. 错误发生后,{{1}}为什么起作用?

解决方法

启用外壳历史记录时,这是竞争条件。有一个公开的报告here

由于disk_log在用户进程之后启动,因此 在关闭时出现竞争状况的机会,其中disk_log将 在组之前终止,它将无法登录。

此外,如果disk_log在shell启动之前终止, 那么整个外壳将无法启动,这将触发 递归地运行另一个Shell,直到系统最终关闭。 可以使用以下命令复制该信息:

$ erl -kernel shell_history true -s init restart