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

Prevent plugin unloading from killing currently running command (soft-purge in-compile) #1686

Merged
merged 2 commits into from
Dec 6, 2017

Conversation

ferd
Copy link
Collaborator

@ferd ferd commented Dec 5, 2017

Really making me hate having all the stuff depend on global paths in the
VM.

Issue at #1650 had reopened. Hopefully this fixes it.

@ferd
Copy link
Collaborator Author

ferd commented Dec 5, 2017

@eproxus can you check that this fixes your thing?

@eproxus
Copy link
Contributor

eproxus commented Dec 5, 2017

@ferd Sorry, same issue:

$ rebar3 --version
===> Compiling rebar3_grisp
===> Compiling rebar3_grisp
rebar 3.4.7+build.3958.ref4cc5533b on Erlang/OTP 19 Erts 8.3
$ DEBUG=1 rebar3 grisp deploy -n robot -v 0.1.0
===> Load global config file ~/.config/rebar3/rebar.config
===> Compiling rebar3_grisp
===> run_hooks("code/robot/_checkouts/rebar3_grisp", pre_hooks, compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", pre_hooks, erlc_compile) -> no hooks defined

===> erlopts [debug_info]
===> files to compile ["code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_util.erl",
                              "code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_deploy.erl",
                              "code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp.erl",
                              "code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_build.erl"]
===> run_hooks("code/robot/_checkouts/rebar3_grisp", post_hooks, erlc_compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", pre_hooks, app_compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", post_hooks, app_compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", post_hooks, compile) -> no hooks defined

===> Compiling rebar3_grisp
===> run_hooks("code/robot/_checkouts/rebar3_grisp", pre_hooks, compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", pre_hooks, erlc_compile) -> no hooks defined

===> erlopts [debug_info]
===> files to compile ["code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_util.erl",
                              "code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_deploy.erl",
                              "code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp.erl",
                              "code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_build.erl"]
===> run_hooks("code/robot/_checkouts/rebar3_grisp", post_hooks, erlc_compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", pre_hooks, app_compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", post_hooks, app_compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", post_hooks, compile) -> no hooks defined

===> Not adding provider grisp deploy from module rebar3_grisp_deploy because it already exists from module rebar3_grisp_deploy
===> Not adding provider grisp build from module rebar3_grisp_build because it already exists from module rebar3_grisp_build
===> Expanded command sequence to be run: []
===> Provider: {default,do}
===> Expanded command sequence to be run: [{default,app_discovery},
                                                  {grisp,deploy}]
===> Provider: {default,app_discovery}
===> Evaluating config script "code/robot/_checkouts/grisp/rebar.config.script"
===> Evaluating config script "code/robot/_checkouts/grisp/rebar.config.script"
===> Compiling rebar3_grisp
===> run_hooks("code/robot/_checkouts/rebar3_grisp", pre_hooks, compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", pre_hooks, erlc_compile) -> no hooks defined

===> erlopts [debug_info]
===> files to compile ["code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_util.erl",
                              "code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_deploy.erl",
                              "code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp.erl",
                              "code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_build.erl"]
===> run_hooks("code/robot/_checkouts/rebar3_grisp", post_hooks, erlc_compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", pre_hooks, app_compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", post_hooks, app_compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", post_hooks, compile) -> no hooks defined

===> Not adding provider grisp deploy from module rebar3_grisp_deploy because it already exists from module rebar3_grisp_deploy
===> Not adding provider grisp build from module rebar3_grisp_build because it already exists from module rebar3_grisp_build
===> Compiling rebar3_grisp
===> run_hooks("code/robot/_checkouts/rebar3_grisp", pre_hooks, compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", pre_hooks, erlc_compile) -> no hooks defined

===> erlopts [debug_info]
===> files to compile ["code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_util.erl",
                              "code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_deploy.erl",
                              "code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp.erl",
                              "code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_build.erl"]
===> run_hooks("code/robot/_checkouts/rebar3_grisp", post_hooks, erlc_compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", pre_hooks, app_compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", post_hooks, app_compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", post_hooks, compile) -> no hooks defined

===> Not adding provider grisp deploy from module rebar3_grisp_deploy because it already exists from module rebar3_grisp_deploy
===> Not adding provider grisp build from module rebar3_grisp_build because it already exists from module rebar3_grisp_build
===> Provider: {grisp,deploy}
===> [{relname,"robot"},{relvsn,"0.1.0"},{force,false}]
===> Current Erlang version ("19") does not match target Erlang version (undefined). It is not guaranteed that the deployed release will work!
===> Expanded command sequence to be run: [{default,app_discovery},
                                                  {default,install_deps},
                                                  {default,lock},
                                                  {default,compile},
                                                  {default,release}]
===> Provider: {default,app_discovery}
===> Evaluating config script "code/robot/_checkouts/grisp/rebar.config.script"
===> Evaluating config script "code/robot/_checkouts/grisp/rebar.config.script"
===> Compiling rebar3_grisp
===> run_hooks("code/robot/_checkouts/rebar3_grisp", pre_hooks, compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", pre_hooks, erlc_compile) -> no hooks defined

===> erlopts [debug_info]
===> files to compile ["code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_util.erl",
                              "code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_deploy.erl",
                              "code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp.erl",
                              "code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_build.erl"]
===> run_hooks("code/robot/_checkouts/rebar3_grisp", post_hooks, erlc_compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", pre_hooks, app_compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", post_hooks, app_compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", post_hooks, compile) -> no hooks defined

===> Not adding provider grisp deploy from module rebar3_grisp_deploy because it already exists from module rebar3_grisp_deploy
===> Not adding provider grisp build from module rebar3_grisp_build because it already exists from module rebar3_grisp_build
===> Compiling rebar3_grisp
===> run_hooks("code/robot/_checkouts/rebar3_grisp", pre_hooks, compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", pre_hooks, erlc_compile) -> no hooks defined

===> erlopts [debug_info]
===> files to compile ["code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_util.erl",
                              "code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_deploy.erl",
                              "code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp.erl",
                              "code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_build.erl"]
===> run_hooks("code/robot/_checkouts/rebar3_grisp", post_hooks, erlc_compile) -> no hooks defined

===> run_hooks("code/robot/_checkouts/rebar3_grisp", pre_hooks, app_compile) -> no hooks defined

{"init terminating in do_boot",killed}
init terminating in do_boot (killed)

Crash dump is being written to: erl_crash.dump...done

erl_crash.dump.txt

@ferd
Copy link
Collaborator Author

ferd commented Dec 5, 2017

Alright, I'll need to dig some more. I'm getting pretty frustrated with the compiler's reliance on global environment and paths always being exactly how they need to be with no way to specify anything literal, this stuff is getting tricky to manage. I'll have to dig again when I have a bit more time.

@eproxus
Copy link
Contributor

eproxus commented Dec 5, 2017

Not sure I follow, could you go into a bit more detail of what the problem is? Perhaps we can help...

@ferd
Copy link
Collaborator Author

ferd commented Dec 5, 2017

So lately, there's been an issue about compiler paths and plugins. Because the Erlang compiler uses the paths currently loaded in the virtual machine to know what to compile with (include directories, versions of modules being called, etc.). Since plugins are for rebar3 and deps are for the apps, we take care to unload all plugins before calling the compiler so that only the deps are in path. This ensures that, for example, no app accidentally depends on a plugin, or that no plugin overrides a dep's version. It's part of ensuring repeatable builds.

However, we had a bug report that some plugins are required during compilation: custom resource handlers (i.e. to download from places that are not git or hg or hex). Those can specify semver values and will need to be called during a final phase of compilation, when generating the .app.src file.

So what we did was a series of patches:

But now things still fail anyway. At the very least, it's no longer the same error as before (you used to have an 'undef' error, meaning the plugin was not in the path). Now from the latest dump, we do get an error about killed which means that when unloading paths, it's possible something maintains an older reference to a fun generated by your plugin, and if that process is the main rebar one, it gets killed.

So uh, there's something in there that needs a fixing. I'm not quite sure what. There's a good chance that path duplication now takes place in another area than the last one I fixed and that causes the multi-reload, it's probably just a question of hunting it down again.

@eproxus
Copy link
Contributor

eproxus commented Dec 5, 2017

Thank you for the lengthy explanation, I hadn't really considered the strange situation with plug-ins and their dependencies affecting compilation of projects with potentially the same dependencies.

I will try to help you as much as I can to trouble shoot this issue. You should also be able to replicate it locally by using our plug-in but unfortunately it requires a few complex tasks to be completed first (building Erlang/OTP for GRiSP among other things). Let us know if you have more fixes to try out.

@ferd
Copy link
Collaborator Author

ferd commented Dec 5, 2017

The good news it appears to have nothing to do with the global plugin. The bad news is that it certainly does kill things, and appears to take place exactly at that spot: https://github.com/erlang/rebar3/pull/1668/files#diff-bb12cff1e7d12d5adbd347f4c98d9f5fR148

@ferd
Copy link
Collaborator Author

ferd commented Dec 5, 2017

Oh oh. Found it I think. We have successfully painted ourselves in a corner with plugins and paths. Almost.

Here goes: when we unload the paths, we do so while being in the command that actually runs the compile job; since the command is part of a plugin, killing it kills rebar3. Woops.

I've just added a patch that could take care of it. Incidentally I don't think the global plugins' paths are required anymore so I'll take that out too. I've also added a regression suite for this.

Prevents the killing of a plugin with itself
@ferd ferd changed the title Fix path reload of global plugins Prevent plugin unloading from killing currently running command (soft-purge in-compile) Dec 5, 2017
@eproxus
Copy link
Contributor

eproxus commented Dec 6, 2017

I am sorry to report it is still not working, but I suspect it is almost there 😄 The unload code needs to purge properly first perhaps?

Module rebar3_grisp_deploy must be purged before deleting

$ rebar3 --version
===> Compiling rebar3_grisp
===> Compiling rebar3_grisp
rebar 3.4.7+build.3960.refd45bacb7 on Erlang/OTP 19 Erts 8.3
$ rebar3 grisp deploy -n robot -v 0.1.0
===> Compiling rebar3_grisp
===> Compiling rebar3_grisp
===> Compiling rebar3_grisp
===> Compiling rebar3_grisp
===> [{relname,"robot"},{relvsn,"0.1.0"},{force,false}]
===> Current Erlang version ("19") does not match target Erlang version (undefined). It is not guaranteed that the deployed release will work!
===> Compiling rebar3_grisp
===> Compiling rebar3_grisp

=ERROR REPORT==== 6-Dec-2017::11:01:48 ===
Module rebar3_grisp_deploy must be purged before deleting

===> Verifying dependencies...
{"init terminating in do_boot",killed}
init terminating in do_boot (killed)

Crash dump is being written to: erl_crash.dump...done
$ DEBUG=1 rebar3 grisp deploy -n robot -v 0.1.0
===> Load global config file ~/.config/rebar3/rebar.config
===> Compiling rebar3_grisp
===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", pre_hooks, compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", pre_hooks, erlc_compile) -> no hooks defined

===> erlopts [debug_info]
===> files to compile ["~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_util.erl",
                              "~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_deploy.erl",
                              "~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp.erl",
                              "~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_build.erl"]
===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", post_hooks, erlc_compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", pre_hooks, app_compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", post_hooks, app_compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", post_hooks, compile) -> no hooks defined

===> Compiling rebar3_grisp
===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", pre_hooks, compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", pre_hooks, erlc_compile) -> no hooks defined

===> erlopts [debug_info]
===> files to compile ["~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_util.erl",
                              "~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_deploy.erl",
                              "~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp.erl",
                              "~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_build.erl"]
===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", post_hooks, erlc_compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", pre_hooks, app_compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", post_hooks, app_compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", post_hooks, compile) -> no hooks defined

===> Not adding provider grisp deploy from module rebar3_grisp_deploy because it already exists from module rebar3_grisp_deploy
===> Not adding provider grisp build from module rebar3_grisp_build because it already exists from module rebar3_grisp_build
===> Expanded command sequence to be run: []
===> Provider: {default,do}
===> Expanded command sequence to be run: [{default,app_discovery},
                                                  {grisp,deploy}]
===> Provider: {default,app_discovery}
===> Evaluating config script "~/code/robot/_checkouts/grisp/rebar.config.script"
===> Evaluating config script "~/code/robot/_checkouts/grisp/rebar.config.script"
===> Compiling rebar3_grisp
===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", pre_hooks, compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", pre_hooks, erlc_compile) -> no hooks defined

===> erlopts [debug_info]
===> files to compile ["~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_util.erl",
                              "~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_deploy.erl",
                              "~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp.erl",
                              "~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_build.erl"]
===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", post_hooks, erlc_compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", pre_hooks, app_compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", post_hooks, app_compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", post_hooks, compile) -> no hooks defined

===> Not adding provider grisp deploy from module rebar3_grisp_deploy because it already exists from module rebar3_grisp_deploy
===> Not adding provider grisp build from module rebar3_grisp_build because it already exists from module rebar3_grisp_build
===> Compiling rebar3_grisp
===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", pre_hooks, compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", pre_hooks, erlc_compile) -> no hooks defined

===> erlopts [debug_info]
===> files to compile ["~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_util.erl",
                              "~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_deploy.erl",
                              "~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp.erl",
                              "~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_build.erl"]
===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", post_hooks, erlc_compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", pre_hooks, app_compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", post_hooks, app_compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", post_hooks, compile) -> no hooks defined

===> Not adding provider grisp deploy from module rebar3_grisp_deploy because it already exists from module rebar3_grisp_deploy
===> Not adding provider grisp build from module rebar3_grisp_build because it already exists from module rebar3_grisp_build
===> Provider: {grisp,deploy}
===> [{relname,"robot"},{relvsn,"0.1.0"},{force,false}]
===> Current Erlang version ("19") does not match target Erlang version (undefined). It is not guaranteed that the deployed release will work!
===> Expanded command sequence to be run: [{default,app_discovery},
                                                  {default,install_deps},
                                                  {default,lock},
                                                  {default,compile},
                                                  {default,release}]
===> Provider: {default,app_discovery}
===> Evaluating config script "~/code/robot/_checkouts/grisp/rebar.config.script"
===> Evaluating config script "~/code/robot/_checkouts/grisp/rebar.config.script"
===> Compiling rebar3_grisp
===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", pre_hooks, compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", pre_hooks, erlc_compile) -> no hooks defined

===> erlopts [debug_info]
===> files to compile ["~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_util.erl",
                              "~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_deploy.erl",
                              "~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp.erl",
                              "~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_build.erl"]
===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", post_hooks, erlc_compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", pre_hooks, app_compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", post_hooks, app_compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", post_hooks, compile) -> no hooks defined

===> Not adding provider grisp deploy from module rebar3_grisp_deploy because it already exists from module rebar3_grisp_deploy
===> Not adding provider grisp build from module rebar3_grisp_build because it already exists from module rebar3_grisp_build
===> Compiling rebar3_grisp
===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", pre_hooks, compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", pre_hooks, erlc_compile) -> no hooks defined

===> erlopts [debug_info]
===> files to compile ["~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_util.erl",
                              "~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_deploy.erl",
                              "~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp.erl",
                              "~/code/robot/_checkouts/rebar3_grisp/src/rebar3_grisp_build.erl"]
===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", post_hooks, erlc_compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", pre_hooks, app_compile) -> no hooks defined


=ERROR REPORT==== 6-Dec-2017::11:02:06 ===
Module rebar3_grisp_deploy must be purged before deleting

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", post_hooks, app_compile) -> no hooks defined

===> run_hooks("~/code/robot/_checkouts/rebar3_grisp", post_hooks, compile) -> no hooks defined

===> Not adding provider grisp deploy from module rebar3_grisp_deploy because it already exists from module rebar3_grisp_deploy
===> Not adding provider grisp build from module rebar3_grisp_build because it already exists from module rebar3_grisp_build
===> Provider: {default,install_deps}
===> Verifying dependencies...
===> sh info:
        cwd: "~/code/robot"
        cmd: hg -R "~/code/robot/_build/default/lib/epmd" --debug id -i

===>    opts: [{use_stdout,false},
                       {debug_abort_on_error,
                           [71,101,116,32,114,101,102,32,111,102,32,104,103,
                            32,100,101,112,101,110,100,101,110,99,121,32,102,
                            97,105,108,101,100,32,105,110,32,
                            "~/code/robot/_build/default/lib/epmd"]}]

===> Port Cmd: hg -R "~/code/robot/_build/default/lib/epmd" --debug id -i
Port Opts: [exit_status,{line,16384},use_stdio,stderr_to_stdout,hide,eof]

===> Comparing hg ref no terminfo entry for invis
no terminfo entry for dim
no terminfo entry for sitm
no terminfo entry for invis
no terminfo entry for dim
no terminfo entry for sitm
no terminfo entry for dim
no terminfo entry for invis
no terminfo entry for sitm
8e70e36b11b0335faa999eeaeef1637b46b962e0 with no terminfo entry for invis
no terminfo entry for dim
no terminfo entry for sitm
no terminfo entry for invis
no terminfo entry for dim
no terminfo entry for sitm
no terminfo entry for dim
no terminfo entry for invis
no terminfo entry for sitm
8e70e36b11b0335faa999eeaeef1637b46b962e0
===> Evaluating config script "~/code/robot/_checkouts/grisp/rebar.config.script"
===> Provider: {default,lock}
===> Provider: {default,compile}
{"init terminating in do_boot",killed}
init terminating in do_boot (killed)

Crash dump is being written to: erl_crash.dump...done

erl_crash.dump.txt

@ferd
Copy link
Collaborator Author

ferd commented Dec 6, 2017

Ah yeah it gives that warning when it can't delete because the purge was soft.

I couldn't get to the second kill because I don't have a project that grisp can fully build on my end. It may need to only do soft purges in that one, but I'm not sure how great that would be for repeatability.

I god damn hate that global state.

@eproxus
Copy link
Contributor

eproxus commented Dec 6, 2017

Here is the implementation of that task: https://github.com/grisp/rebar3_grisp/blob/master/src/rebar3_grisp_deploy.erl#L49-L69

In make_release/4 we do some very ugly hacks to be able to generate a release, we switch back to the default namespace, run the release task and then switch back to grisp. Perhaps this is related to the problem?

If there is a better way to run another task as a dependency with custom configuration, I'm all ears.

Rather than the caller having to think of what to purge or not, use
erlang:check_process_code/2 to detect if the caller (rebar3) may die
because of the operation.

If so, do a soft purge with a conditional delete instead of a hard purge
with a mandatory delete.
@ferd
Copy link
Collaborator Author

ferd commented Dec 6, 2017

I've just pushed a patch that changes the approach. I was reading the stdlib doc and found about erlang:check_process_code/2, which exists as far back as R16. This one will tell the process for which we call whether it holds references to code, which could kill it on a purge.

Whenever a specific module is being held, we run a soft purge with a conditional code delete, rather than a full purge. This should eliminate most problems. I've added a debug message to figure out if it ever causes other issues.

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

Successfully merging this pull request may close these issues.

3 participants