cabol / jchash Goto Github PK
View Code? Open in Web Editor NEWJump Consistent Hash NIF library for Erlang/Elixir
License: MIT License
Jump Consistent Hash NIF library for Erlang/Elixir
License: MIT License
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"]
Hi, @cabol hope you're going well.
I'm using Nebulex with Redis Cluster as backend. I have as a requirement a small docker image size to deploy my application. But, when I use Elixir Docker Slim Image or Elixir Docker Alpine Image I receive an error when Mix tries to compile jchash:
** (Mix) Could not compile dependency :jchash, "/root/.mix/rebar3 bare compile --paths "/upa/_build/prod/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile jchash", update it with "mix deps.update jchash" or clean it with "mix deps.clean jchash"
Versions:
{:jchash, "0.1.1"}
Elixir: 1.8.2
Erlang: 22
{:nebulex, "~> 1.1"},
{:nebulex_redis_adapter, "~> 1.1"}
Can you help me to find which OS dependency I must to install to solve this?
I'm getting the following error when trying to build the dependency:
===> Compiling jchash
cc /Users/username/projects/company/enterprise/deps/jchash/c_src/jchash.o -L/usr/local/opt/libxslt/lib -shared -L /Users/username/.asdf/installs/erlang/21.3/lib/erl_interface-3.11/lib -lerl_interface -lei -o /Users/username/projects/company/enterprise/deps/jchash/c_src/../priv/jchash.so
Undefined symbols for architecture x86_64:
"_enif_get_uint", referenced from:
_compute in jchash.o
"_enif_get_ulong", referenced from:
_compute in jchash.o
"_enif_make_badarg", referenced from:
_compute in jchash.o
"_enif_make_int", referenced from:
_compute in jchash.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/Users/username/projects/company/enterprise/deps/jchash/c_src/../priv/jchash.so] Error 1
===> Hook for compile failed!
** (Mix) Could not compile dependency :jchash, "/Users/username/.asdf/installs/elixir/1.7.4/.mix/rebar3 bare compile --paths "/Users/username/projects/company/enterprise/_build/test/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile jchash", update it with "mix deps.update jchash" or clean it with "mix deps.clean jchash"```
Both erlang and elixir are installed via `asdf`.
Any suggestion?
Thanks!
On Ubuntu 20.04 trying to use OTP v23 with jchash i get the following:
$ mix deps.compile jchash
===> Compiling jchash
make: Entering directory '/project/deps/jchash/c_src'
cc -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes -fPIC -I /usr/lib/erlang/erts-11.0.2/include/ -I /usr/lib/erlang/lib/erl_interface-4.0/include -c -o /project/deps/jchash/c_src/jchash.o /project/deps/jchash/c_src/jchash.c
cc /project/deps/jchash/c_src/jchash.o -shared -L /usr/lib/erlang/lib/erl_interface-4.0/lib -lerl_interface -lei -o /project/deps/jchash/c_src/../priv/jchash.so
/usr/bin/ld: cannot find -lerl_interface
collect2: error: ld returned 1 exit status
make: *** [Makefile:59: /project/deps/jchash/c_src/../priv/jchash.so] Error 1
make: Leaving directory '/project/deps/jchash/c_src'
===> Hook for compile failed!
$ dpkg -l|grep esl-erlang
ii esl-erlang 1:23.0.2-1
Is the deprecation of erl_interface the reason, mentioned here?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.