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

jchash.start undefined function #13

Closed
jnatherley opened this issue May 16, 2019 · 7 comments
Closed

jchash.start undefined function #13

jnatherley opened this issue May 16, 2019 · 7 comments

Comments

@jnatherley
Copy link

jnatherley commented May 16, 2019

Hey Cabol,

First of all fantastic library, it's super easy to use and works extremely nicely. We've had a small issue building a repeatable docker image for our elixir umbrella app. This is the error that is thrown when including the nebulex_redis_adapter

web_1    | 17:54:26.884 [info] Application jchash exited: exited in: :jchash.start(:normal, [])
web_1    |     ** (EXIT) an exception was raised:
web_1    |         ** (UndefinedFunctionError) function :jchash.start/2 is undefined or private
web_1    |             (jchash) :jchash.start(:normal, [])
web_1    |             (kernel) application_master.erl:277: :application_master.start_it_old/4
web_1    | {"Kernel pid terminated",application_controller,"{application_start_failure,jchash,{bad_return,{{jchash,start,[normal,[]]},{'EXIT',{undef,[{jchash,start,[normal,[]],[]},{application_master,start_it_old,4,[{file,\"application_master.erl\"},{line,277}]}]}}}}}"}
web_1    | Kernel pid terminated (application_controller) ({application_start_failure,jchash,{bad_return,{{jchash,start,[normal,[]]},{'EXIT',{undef,[{jchash,start,[normal,[]],[]},{application_master,start_it_old
web_1    |
web_1    | Crash dump is being written to: erl_cra

Tested with: nebulex_redis_adapter ~> "1.0.0" & nebulex_redis_adapter ~> "1.1.0"

@cabol
Copy link
Owner

cabol commented May 17, 2019

@jnatherley I'm glad to hear that, thanks a lot :) ... on the other hand, let me check and get back to you ASAP

@jnatherley
Copy link
Author

Hey @cabol

Just did some more digging now, it looks like it's not being compiled:
Using elixir:1.7.2-alpine

===> Compiling jchash
make: Entering directory '/opt/app/deps/jchash/c_src'
cc -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes -fPIC -I /usr/local/lib/erlang/erts-10.0.5/include/ -I /usr/local/lib/erlang/lib/erl_interface-3.10.3/include  -c -o /opt/app/deps/jchash/c_src/jchash.o /opt/app/deps/jchash/c_src/jchash.c
cc /opt/app/deps/jchash/c_src/jchash.o -shared -L /usr/local/lib/erlang/lib/erl_interface-3.10.3/lib -lerl_interface -lei -o /opt/app/deps/jchash/c_src/../priv/jchash.so
make: Leaving directory '/opt/app/deps/jchash/c_src'
===> Compiling ranch

Thanks again :)

@jnatherley
Copy link
Author

jnatherley commented May 17, 2019

I transitioned this app from being a standalone phoenix app and now as part of an umbrella, in the standalone phoenix app when doing the mix release it looks like this dependency was never fetched, but as apart of the umbrella it is fetched and compiled.

EDIT:

Seems like downgrading to 1.0.1 solved the issue.

@cabol
Copy link
Owner

cabol commented May 17, 2019

You meant 1.0.0 right? because for NebulexRedisAdapter there are only two releases, 1.0.0 and 1.1.0 – release 1.0.1 is available but in Nebulex.

@cabol
Copy link
Owner

cabol commented May 17, 2019

I think what is the issue, while I push the fix on the master branch, you can do this workaround:

Within the rel/config.exs file add :jchash to the list of apps in the release section:

release :your_app do
  set version: current_version(:your_app)
  set applications: [
    :runtime_tools,
    :jchash
  ]
end

Or you can also add :jchash to the included apps in your mix.exs:

def application do
  [
    extra_applications: [:logger],
    included_applications: [:jchash],
    mod: {YourApp.Application, []}
  ]
end

I will try to push the fix ASAP, but in the meantime let me know if the workaround works.

cabol added a commit that referenced this issue May 18, 2019
@cabol
Copy link
Owner

cabol commented May 18, 2019

@jnatherley I've pushed the fix to master, try it out and please let me know if it works. Stay tuned!

@jnatherley
Copy link
Author

thanks @cabol

I'll give this fix a whirl!

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

No branches or pull requests

2 participants