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

try code:load_file if loading with code:ensure_loaded fails #1790

Closed
wants to merge 1 commit into from

Conversation

hmmr
Copy link
Contributor

@hmmr hmmr commented Jun 21, 2021

code:ensure_loaded fails if our code server is in embedded mode, causing riak_cs to fail to configure riak with a custom backend storage:

     [{add_paths,
          ["/home/hmmr/X/titokyo/g/riak_cs/dev/dev1/riak-cs/lib/riak_cs-3.0.0pre3+build.3435.ref2aaece2f/ebin"]},
      {storage_backend,riak_cs_kv_multi_backend},
      ...

Loading the module with code:load_file/1 actually makes it happen.

ensure_loaded fails if our code server is in embedded mode.
@martinsumner
Copy link
Contributor

Another Riak user raised the issue of code in additional paths not working in riak_kv >= 3.0 (e.g. map/reduce functions), and returning {error, embedded} instead.

As part of the switch to OTP 20 with 3.0, the switch was made to relx - and this changes the default mode from interactive to embedded:

https://github.com/erlware/relx/blob/master/priv/templates/extended_bin#L923-L924

So it appears the root cause here is we're now running embedded. But this wasn't a deliberate change. So perhaps the best answer, to solve this and other dynamic code loading issues, is to switch back to interactive.

For packaged deployments - I think we could do this by setting the CODE_LOADING_MODE in the riak script https://github.com/basho/riak/blob/develop-3.0/rel/files/riak. This wouldn't work though when running direct from make rel and make devrel.

Are there any objections to switching back to interactive mode? @martincox

@martinsumner
Copy link
Contributor

See basho/riak#1077

This changes the default back to interactive by using a pre_start script (as with changing the max log size). This seems better than changing rel/fiiles/riak.

@hmmr
Copy link
Contributor Author

hmmr commented Jul 1, 2021

As far as #1077 fixes the loading regression, I'm totally fine with the proposed change to interactive mode.

@hmmr
Copy link
Contributor Author

hmmr commented Aug 13, 2021

Closing as basho/riak#1077 has been merged.

@hmmr hmmr closed this Aug 13, 2021
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.

2 participants