Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot create regular file ‘/data/apps/appname/var/vm.args.bak’: File exists #725

Open
suexcxine opened this issue Mar 23, 2020 · 2 comments

Comments

@suexcxine
Copy link

suexcxine commented Mar 23, 2020

Steps to reproduce

use supervisord to start multiple instances

Verbose Logs

supervisor> start ribbon:
ribbon:ribbon_1: started
ribbon:ribbon_0: started
supervisor> tail -f ribbon:ribbon_0 stderr
==> Press Ctrl-C to exit <==
Kernel pid terminated (application_controller) ({application_start_failure,ribbon,{bad_return,{{'Elixir.Ribbon.Application',start,[normal,[]]},{'EXIT',{{badmatch,{error,{shutdown,{failed_to_start_chil

Crash dump is being written to: erl_crash.dump...done
cp: cannot create regular file ‘/data/apps/ribbon/var/vm.args.bak’: File exists
2020-03-23 18:06:45.052733 Multiple -~p given to erl, using the first, ~p
                Protocol 'inet_tcp': the name [email protected] seems to be in use by another Erlang node
Protocol 'inet_tcp': the name [email protected] seems to be in use by another Erlang node

Description of issue

  • What version of Distillery?
    2.1.1
  • What OS, Erlang/Elixir versions are you seeing this issue on?
    CentOS 7
  • If possible, also provide your rel/config.exs, as it is often
    my first troubleshooting question, and you'll save us both time :)
# Import all plugins from `rel/plugins`
# They can then be used by adding `plugin MyPlugin` to
# either an environment, or release definition, where
# `MyPlugin` is the name of the plugin module.
~w(rel plugins *.exs)
|> Path.join()
|> Path.wildcard()
|> Enum.map(&Code.eval_file(&1))

use Distillery.Releases.Config,
    # This sets the default release built by `mix distillery.release`
    default_release: :default,
    # This sets the default environment used by `mix distillery.release`
    default_environment: Mix.env()

# For a full list of config options for both releases
# and environments, visit https://hexdocs.pm/distillery/config/distillery.html


# You may define one or more environments in this file,
# an environment's settings will override those of a release
# when building in that environment, this combination of release
# and environment configuration is called a profile

environment :dev do
  # If you are running Phoenix, you should make sure that
  # server: true is set and the code reloader is disabled,
  # even in dev mode.
  # It is recommended that you build with MIX_ENV=prod and pass
  # the --env flag to Distillery explicitly if you want to use
  # dev mode.
  set dev_mode: true
  set include_erts: false
  set cookie: :"WW:`4m$YU76?D^g;wD5XI$?=Y%N.dSkY$M[XIeE_p>&(pv&)t&pBorR0tNmH5hI9"
  set vm_args: "rel/vm.args"
end

environment :prod do
  set include_erts: true
  set include_src: false
  set cookie: :"Gu31aozN7M(EG0K!HRW4t{TRN(7uED?dL|<=@EaJ2=D)jM~]W/yN4g5_[Wvt{GTR"
  set vm_args: "rel/vm.args"
end

# You may define one or more releases in this file.
# If you have not set a default release, or selected one
# when running `mix distillery.release`, the first release in the file
# will be used by default

release :ribbon do
  set version: current_version(:ribbon)
  set applications: [
    :runtime_tools
  ]
end

vm.args

## This file provide the arguments provided to the VM at startup
## You can find a full list of flags and their behaviours at
## http://erlang.org/doc/man/erl.html

## Name of the node
-name <%= release_name %>${SID}@${HOSTNAME}

## Cookie for distributed erlang
-setcookie <%= release.profile.cookie %>
## -setcookie ${ERLANG_COOKIE}


-smp auto

+c true
+C multi_time_warp

+zdbbl 81920

# max actor count in one erlang VM, a million should be enough
+P 1048576

ribbon.conf used in supervisor

[program:ribbon]
numprocs=2
numprocs_start=0
user=myuser
environment=SID=%(process_num)d
command=/data/apps/ribbon/bin/ribbon.sh
process_name=%(program_name)s_%(process_num)d
directory=/data/apps/ribbon
autostart=false
autorestart=false
startretries=0
stderr_logfile=/data/logs/supervisor/ribbon/ribbon-stderr.log
stderr_logfile_maxbytes=100MB
stderr_logfile_backups=2
stdout_logfile=/data/logs/supervisor/ribbon/ribbon-stdout.log
stdout_logfile_maxbytes=100MB
stdout_logfile_backups=20

/data/apps/ribbon/bin/ribbon.sh

#!/bin/bash

host_local_ip=`curl -s http://169.254.169.254/latest/meta-data/local-ipv4`
export REPLACE_OS_VARS=true
export HOSTNAME=${host_local_ip}
export PORT=40000
export MYSQL_USER=root
export MYSQL_DATABASE=test
export PROG=/data/apps/ribbon/bin/ribbon

exec $PROG foreground
@suexcxine
Copy link
Author

suexcxine commented Mar 23, 2020

Seems that distillery will change this:

## Name of the node
-name <%= release_name %>${SID}@${HOSTNAME}

to this

## Name of the node
-name [email protected]

and backup files are involved,
so two processes lead to conflict

@suexcxine
Copy link
Author

suexcxine commented Mar 23, 2020

I think this won't happen in docker container
Or we can use different release directories to walkaround this

Do we have other options ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant