cabol / jchash

Jump Consistent Hash NIF library for Erlang/Elixir

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting on_load_function_failed for :jchash when using nebulex_redis_adapter or nebulex_partitioned_cache on docker

srjobinar opened this issue · comments

Hi @cabol
Tried setting up a quick application using Nebulex to see how it can be used in our live systems.
I am able to run the application on my local using mix and also using distillery release.
But when I try to create a docker image using elixir:1.9-alpine I get the following error:

2020-06-22 04:17:21.837997 supervisor_report   #{label=>{supervisor,start_error},report=>[{supervisor,{local,kernel_sup}},{errorContext,start_error},{reason,{on_load_function_failed,jchash}},{offender,[{pid,undefined},{id,kernel_safe_sup},{mfargs,{supervisor,start_link,[{local,kernel_safe_sup},kernel,safe]}},{restart_type,permanent},{shutdown,infinity},{child_type,supervisor}]}]}
20#20-06-22 04:17:21.838071 crash_report        {label=>{proc_lib,crash},report=>[[{initial_call,{supervisor,kernel,['Argument__1']}},{pid,<0.990.0>},{registered_name,[]},{error_info,{exit,{on_load_function_failed,jchash},[{init,run_on_load_handlers,0,[]},{kernel,init,1,[{file,"kernel.erl"},{line,189}]},{supervisor,init,1,[{file,"supervisor.erl"},{line,295}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,374}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,342}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}},{ancestors,[kernel_sup,<0.965.0>]},{message_queue_len,0},{messages,[]},{links,[<0.967.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,610},{stack_size,27},{reductions,265}],[]]}
#{label=>{proc_lib,crash},report=>[[{initial_call,{application_master,init,['Argument__1','Argument__2','Argument__3','Argument__4']}},{pid,<0.964.0>},{registered_name,[]},{error_info,{exit,{{shutdown,{failed_to_start_child,kernel_sa2020-06-22 04:17:22.862111 crash_report        fe_sup,{on_load_function_failed,jchash}}},{kernel,start,[normal,[]]}},[{application_master,init,4,[{file,"application_master.erl"},{line,138}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}},{ancestors,[<0.963.0>]},{message_queue_len,1},{messages,[{'EXIT',<0.965.0>,normal}]},{links,[<0.963.0>,<0.961.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,610},{stack_size,27},{reductions,193}],[]]}
2020-06-22 04:17:22.863361 std_info            #{label=>{application_controller,exit},report=>[{application,kernel},{exited,{{shutdown,{failed_to_start_child,kernel_safe_sup,{on_load_function_failed,jchash}}},{kernel,start,[normal,[]]}}},{type,permanent}]}
{"Kernel pid terminated",application_controller,"{application_start_failure,kernel,{{shutdown,{failed_to_start_child,kernel_safe_sup,{on_load_function_failed,jchash}}},{kernel,start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,kernel,{{shutdown,{failed_to_start_child,kernel_safe_sup,{on_load_function_failed,jchash}}},{kernel,start,[normal,[]]}}})

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

here's the Dockerfile I'm using:

FROM elixir:1.9-alpine

RUN apk update && \
    apk upgrade --no-cache &&\
    apk add --no-cache \
      bash \
      openssl-dev \
      build-base

# Install Hex+Rebar
RUN mix local.hex --force && \
    mix local.rebar --force

WORKDIR /opt/app

ENV MIX_ENV=prod

ADD . .
RUN mix deps.get
RUN mix distillery.release

# Use REPLACE_OS_VARS=true in order to swap runtime env values in rel/vm.args
ENV REPLACE_OS_VARS=true

# Do not use CMD, leads to issues receiving SIGTERM properly
ENTRYPOINT ["_build/prod/rel/nebulex_test_cluster/bin/nebulex_test_cluster", "foreground"]

@cabol
Seems to be an issue in my Dockerfile as I was using ADD . . which was adding compiled NIF's to the docker.
Got help from elixir slack channel.
Should have probably tried that first, sorry :)

No problem, I'm glad you were able to sort it out 😉 !