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

Fix error when running in a release #41

Merged
merged 1 commit into from
Feb 16, 2019

Conversation

peburrows
Copy link
Contributor

@peburrows peburrows commented Feb 16, 2019

When attempting to run a release build of an app that uses Nebulex, trying to start a cache will result in an error that looks something like the following:

[info] Application my_app exited: MyApp.Application.start(:normal, []) returned an error: shutdown: failed to start child: MyApp.Cache
    ** (EXIT) shutdown: failed to start child: MyApp.Cache.ShardsSupervisor
        ** (EXIT) an exception was raised:
            ** (UndefinedFunctionError) function :shards_sup.start_link/1 is undefined (module :shards_sup is not available)
                :shards_sup.start_link(MyApp.Cache.ShardsSupervisor)
                (stdlib) supervisor.erl:379: :supervisor.do_start_child_i/3 
                (stdlib) supervisor.erl:365: :supervisor.do_start_child/2
                (stdlib) supervisor.erl:349: anonymous fn/3 in :supervisor.start_children/2
                (stdlib) supervisor.erl:1157: :supervisor.children_map/4
                (stdlib) supervisor.erl:315: :supervisor.init_children/2
                (stdlib) gen_server.erl:374: :gen_server.init_it/2
                (stdlib) gen_server.erl:342: :gen_server.init_it/6
                (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

This happens because the :shards dependency is not packaged as part of the release. Removing the explicit :applications list and instead letting Elixir automatically infer the applications list (a feature introduced in Elixir v1.4) fixes the issue.

(BTW, I left the application/0 function around (even though it now returns an empty list), but I'm pretty sure you could also just remove its declaration entirely)

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 354d0db on peburrows:fix-release-error-shards into df9146e on cabol:master.

@cabol
Copy link
Owner

cabol commented Feb 16, 2019

Nice! I think this also solves #26

@cabol cabol merged commit 0cbb938 into cabol:master Feb 16, 2019
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.

None yet

3 participants