-
Notifications
You must be signed in to change notification settings - Fork 517
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
Support setting shell hot code loading blacklists #2013
Conversation
by default, all apps except internal rebar3 ones can be blacklisted. Some months ago, someone added support for configurable lists within rebar3 itself using the .app env. This PR re-exports that functionality from the rebar.config file, so that one can set something like: {shell, [ {app_reload_blacklist, [cowboy, ranch]} ]}. Which will allow to prevent applications that often crash when being reloaded from doing so. For example, cowboy and ranch processes can be stuck in an accept call for multiple reloads in dev, which ends up causing large failures.
fb984f4
to
e3c3c0b
Compare
It looks like I have a problem with this option: in my rebar.config
and no special configs for test profile. then I do
If I remove
|
Managed to reproduce with following minimal config:
|
That's odd, did not have the problem when I tried it with the app booting and all. I guess the issue comes when the module is loaded but not being used, then it gets dropped off the path during compilation, but never re-added properly somehow? |
@ferd it can be reproduced if I do |
Should I create a separate issue? |
Yeah you can create an issue. I'm pretty sure the problem is some interplay on path loading that I had avoided modifying when moving to 3.7.0 but it's an easy enough test case to optimize around. The reason the old processes keep running is that if the code is being run, the module is not unloaded/hard-purged, so any started code will run fine (which is what I tested when I implemented the blacklist), but it won't work well when code was loaded but inactive (unloads and won't come back, which I had not considered and did not test) |
Sorry for digging up an old PR, but @seriyps did you found a workaround for this? |
@sirn no, I haven't. |
rebar3's shell allows people to set applications as blacklisted to prevent them from being reloaded because that can cause crashes. However, as part of its normal operations, rebar_paths unloads all modules that are currently not "owned" by at least one process, considering them safe to do so. These two behaviours, put together, lead to an odd thing where some modules are suddenly unloaded and not in path, and that can be confusing. This calls for a unification of both features. We could decide to be pushing the complexity of rebar3's shell into rebar_path so it knows of blacklists, but this would be a bad idea because rebar_agent already owns all the damn hack. So instead this fix adds an optional call within rebar_agent's blacklisted applications handling that calls `code:ensure_loaded/1` on their modules. This avoids forcing any code change that would cause a crash, but reinstates unloaded paths that could be confusing. Addresses some comments in erlang#2013
See #2099 as an attempt to fix this. |
by default, all apps except internal rebar3 ones can be blacklisted.
Some months ago, someone added support for configurable lists within
rebar3 itself using the .app env.
This PR re-exports that functionality from the rebar.config file, so
that one can set something like:
Which will allow to prevent applications that often crash when being
reloaded from doing so. For example, cowboy and ranch processes can be
stuck in an accept call for multiple reloads in dev, which ends up
causing large failures.