Upgraded asdf to 0.7.0 using asdf update, upgraded plugins using asdf plugin-update --all. Run an Elixir REPL: iex. Happens when exiting Erlang REPL erl as well.
Normally when exiting with ctrl-c ctrl-c or ctrl-\ the app exits quietly.
When using ctrl-c ctrl-c app exits normally. When using ctrl-\ I see the following output:
โฏ iex
Erlang/OTP 21 [erts-10.2.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]
Interactive Elixir (1.8.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> /Users/craig/.asdf/lib/utils.sh: line 478: 13103 Quit: 3 ( if [ "$version" = "system" ]; then
"$callback"; exit $?;
fi; local plugin_path; plugin_path=$(get_plugin_path "$plugin_name"); local path; path="$(list_plugin_exec_paths "$plugin_name" "$full_version" | tr '\n' ':'):$PATH"; if [ ! -f "${plugin_path}/bin/exec-env" ]; then
PATH=$path "$callback"; exit $?;
fi; local install_path; install_path=$(find_install_path "$plugin_name" "$full_version"); ASDF_INSTALL_TYPE=$install_type; ASDF_INSTALL_VERSION=$version; ASDF_INSTALL_PATH=$install_path; export ASDF_INSTALL_TYPE; export ASDF_INSTALL_VERSION; export ASDF_INSTALL_PATH; source "${plugin_path}/bin/exec-env"; unset ASDF_INSTALL_TYPE; unset ASDF_INSTALL_VERSION; unset ASDF_INSTALL_PATH; PATH=$path "$callback"; exit $? )
/Users/craig/.asdf/lib/utils.sh: line 478: 12979 Quit: 3 ( if [ "$version" = "system" ]; then
"$callback"; exit $?;
fi; local plugin_path; plugin_path=$(get_plugin_path "$plugin_name"); local path; path="$(list_plugin_exec_paths "$plugin_name" "$full_version" | tr '\n' ':'):$PATH"; if [ ! -f "${plugin_path}/bin/exec-env" ]; then
PATH=$path "$callback"; exit $?;
fi; local install_path; install_path=$(find_install_path "$plugin_name" "$full_version"); ASDF_INSTALL_TYPE=$install_type; ASDF_INSTALL_VERSION=$version; ASDF_INSTALL_PATH=$install_path; export ASDF_INSTALL_TYPE; export ASDF_INSTALL_VERSION; export ASDF_INSTALL_PATH; source "${plugin_path}/bin/exec-env"; unset ASDF_INSTALL_TYPE; unset ASDF_INSTALL_VERSION; unset ASDF_INSTALL_PATH; PATH=$path "$callback"; exit $? )
MacOS 10.14.2 (18C54)
asdf version: 0.7.0
You need to run asdf reshim after upgrading, did you? I'm not able to reproduce this issue on OSX 10.14.3.
I hadn't run reshim, but after doing so there is no change
Just to be sure, I wiped my ~/.asdf dir, cloned asdf from git and installed elixir and erlang from scratch, same error
I was able to reproduce this on my machine now. @asdf-vm/core I think this is caused by the shims no longer using exec to execute the executables installed by plugins. I think this change was made so we could have post run hooks - https://github.com/asdf-vm/asdf/blob/master/lib/commands/shim-exec.sh#L24. I think we should revert some of these changes so exec is used again. There are a couple benefits to reverting back to using exec:
exec the pid of the process the user started is the shim, so if they want the process running the actually executable they will have to find it some other way. With exec the pid of the executable will be the same as the pid of the process the user started because exec replaces the current process image with a new process image in place.exec and one process running all signals will go to the executable itself, rather than going to the shim. This is what is causing the issue here I believe. The shim is receiving the signal.+1 for reverting to exec
Currently, something like "elixir -S mix run --no-halt" is 4 levels deep in the process tree (shim calling shim etc).
user 20083 1 0 Mar15 ? S 0:00 bash /home/user/.asdf/bin/asdf exec elixir --sname hds -S mix run --no-halt
user 20129 20083 0 Mar15 ? S 0:00 \_ bash /home/user/.asdf/bin/asdf exec elixir --sname hds -S mix run --no-halt
user 20169 20129 0 Mar15 ? S 0:00 \_ bash /home/user/.asdf/bin/asdf exec erl -pa /home/user/.asdf/installs/elixir/1.8.1-otp-21/...
user 20259 20169 0 Mar15 ? S 0:00 \_ bash /home/user/.asdf/bin/asdf exec erl -pa /home/user/.asdf/installs/elixir/1.8.1-otp-21/...
user 20293 20259 0 Mar15 ? Sl 2:30 \_ hds -- -root /home/user/.asdf/installs/erlang/21.2.7 -progname erl -- -home /home/user -- -pa /home/user/.asdf/installs/elixir/1.8.1-otp-21/...
There is also the expectation that the pid of the command just run is the pid of the actual process and not a shim...
@Stratus3D I agree that we should revert to using exec.
@asdf-vm/core What should we do with the hooks. pre-hook should be easy enough but I am not sure there is a reliable to do a post-hook while using exec.
@danhper I think we can keep our pre-hook code pretty much the way it is. Everything before the exec should still work fine. Once we invoke exec we lose control, so I don't think we can post-hooks without having a second process "in control" of the actual process. But 0.7.0 was the first release that included these hooks, so I doubt many people are using them. And in my mind pre-hooks are the more useful of the two.
@Stratus3D Yes, I agree.
@vic What do you think?
@asdf-vm/core I suggest we revert to exec and release v0.7.1, what do you think?
I would also suggest reverting to use exec. I've been having similar issues: I need to send signals to a process started via an asdf shim, and it does not work using asdf 0.7.0.
I think we should make the changes needed to revert to exec as soon as possible.
@craigp I just verified that @danhper PR fixed this issue for me.
Thanks all, great work
Most helpful comment
+1 for reverting to exec
Currently, something like "elixir -S mix run --no-halt" is 4 levels deep in the process tree (shim calling shim etc).
There is also the expectation that the pid of the command just run is the pid of the actual process and not a shim...