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

Problematic dependency - hdr_histogram #86

Open
afronski opened this issue Sep 28, 2017 · 3 comments
Open

Problematic dependency - hdr_histogram #86

afronski opened this issue Sep 28, 2017 · 3 comments

Comments

@afronski
Copy link
Contributor

Currently we're leveraging work done by hdr_histogram regarding statistics accumulation / storage, which brings set of problems to the table:

  1. It is a NIF - and that causes a lot of troubles when building xprof on various platforms (too old GCC, too new GCC.
  2. Current hex.pm package is too old and it is not in sync with upstream - that's why we're using this fork https://github.com/afronski/hdr_histogram_erl and different name on hex.pm (customized_hdr_histogram).

We need to improve that. Possible solutions:

  1. Getting rid of NIFs - Erlang / Elixir only library.
  2. Contributing build process fixes and enforcing updating hex.pm package regularly.
@afronski
Copy link
Contributor Author

afronski commented Sep 28, 2017

One of the errors that affected people on macOS during the ElixirConf US workshops:

user@hostname ~/.../elixir-fire-brigade-workshop/apps/tracing_4 $ iex -S mix
Erlang/OTP 20 [erts-9.0.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] 
[hipe] [kernel-poll:false] [dtrace]
 
===> Compiling customized_hdr_histogram
cc ...
Undefined symbols for architecture x86_64:
  "_deflate", referenced from:
      _hdr_encode_compressed in hdr_histogram_log.o
  "_deflateEnd", referenced from:
      _hdr_encode_compressed in hdr_histogram_log.o
  "_deflateInit_", referenced from:
      _hdr_encode_compressed in hdr_histogram_log.o
  "_enif_alloc", referenced from:
      __hi_init in hdr_histogram_nif.o
      _on_load in hdr_histogram_nif.o
  "_enif_alloc_binary", referenced from:
      __hh_to_binary in hdr_histogram_nif.o
      __hh_to_binary_uncompressed in hdr_histogram_nif.o
  "_enif_alloc_resource", referenced from:
      __hh_open in hdr_histogram_nif.o
      __hh_from_binary in hdr_histogram_nif.o
      __hi_open in hdr_histogram_nif.o
  "_enif_free", referenced from:
      __hi_close in hdr_histogram_nif.o
      _on_unload in hdr_histogram_nif.o
      __hi_ctx_dtor in hdr_histogram_nif.o
  "_enif_get_double", referenced from:
      __hh_percentile in hdr_histogram_nif.o
      _parse_opt in hdr_histogram_nif.o
  "_enif_get_int", referenced from:
      __hh_open in hdr_histogram_nif.o
  "_enif_get_list_cell", referenced from:
      _parse_opts in hdr_histogram_nif.o
      __hi_init in hdr_histogram_nif.o
  "_enif_get_long", referenced from:
      __hh_open in hdr_histogram_nif.o
      __hh_record in hdr_histogram_nif.o
      __hh_record_corrected in hdr_histogram_nif.o
      __hh_record_many in hdr_histogram_nif.o
      __hh_same in hdr_histogram_nif.o
      __hh_lowest_at in hdr_histogram_nif.o
      __hh_count_at in hdr_histogram_nif.o
      ...
  "_enif_get_resource", referenced from:
      __hh_get_memory_size in hdr_histogram_nif.o
      __hh_get_total_count in hdr_histogram_nif.o
      __hh_record in hdr_histogram_nif.o
      __hh_record_corrected in hdr_histogram_nif.o
      __hh_record_many in hdr_histogram_nif.o
      __hh_add in hdr_histogram_nif.o
      __hh_min in hdr_histogram_nif.o
      ...
  "_enif_get_string", referenced from:
      __hh_log_classic in hdr_histogram_nif.o
      __hh_log_csv in hdr_histogram_nif.o
  "_enif_get_tuple", referenced from:
      _parse_opt in hdr_histogram_nif.o
  "_enif_get_uint", referenced from:
      _parse_opt in hdr_histogram_nif.o
      __hi_open in hdr_histogram_nif.o
  "_enif_inspect_binary", referenced from:
      __hh_from_binary in hdr_histogram_nif.o
  "_enif_is_list", referenced from:
      __hi_init in hdr_histogram_nif.o
  "_enif_make_atom", referenced from:
      __hh_open in hdr_histogram_nif.o
      __hh_get_memory_size in hdr_histogram_nif.o
      __hh_get_total_count in hdr_histogram_nif.o
      __hh_record in hdr_histogram_nif.o
      __hh_record_corrected in hdr_histogram_nif.o
      __hh_record_many in hdr_histogram_nif.o
      __hh_add in hdr_histogram_nif.o
      ...
  "_enif_make_badarg", referenced from:
      __hh_open in hdr_histogram_nif.o
      __hh_get_memory_size in hdr_histogram_nif.o
      __hh_get_total_count in hdr_histogram_nif.o
      __hh_record in hdr_histogram_nif.o
      __hh_record_corrected in hdr_histogram_nif.o
      __hh_record_many in hdr_histogram_nif.o
      __hh_add in hdr_histogram_nif.o
      ...
  "_enif_make_binary", referenced from:
      __hh_to_binary in hdr_histogram_nif.o
      __hh_to_binary_uncompressed in hdr_histogram_nif.o
  "_enif_make_double", referenced from:
      __hh_mean in hdr_histogram_nif.o
      __hh_median in hdr_histogram_nif.o
      __hh_stddev in hdr_histogram_nif.o
      __hh_percentile in hdr_histogram_nif.o
      __hi_next in hdr_histogram_nif.o
  "_enif_make_int", referenced from:
      __hi_next in hdr_histogram_nif.o
  "_enif_make_list", referenced from:
      __hi_next in hdr_histogram_nif.o
  "_enif_make_long", referenced from:
      __hh_add in hdr_histogram_nif.o
      __hh_min in hdr_histogram_nif.o
      __hh_max in hdr_histogram_nif.o
      __hh_lowest_at in hdr_histogram_nif.o
      __hh_count_at in hdr_histogram_nif.o
      __hi_next in hdr_histogram_nif.o
  "_enif_make_resource", referenced from:
      __hh_open in hdr_histogram_nif.o
      __hh_from_binary in hdr_histogram_nif.o
      __hi_open in hdr_histogram_nif.o
  "_enif_make_tuple", referenced from:
      __hh_open in hdr_histogram_nif.o
      __hh_get_memory_size in hdr_histogram_nif.o
      __hh_get_total_count in hdr_histogram_nif.o
      __hh_record in hdr_histogram_nif.o
      __hh_record_corrected in hdr_histogram_nif.o
      __hh_record_many in hdr_histogram_nif.o
      __hh_add in hdr_histogram_nif.o
      ...
  "_enif_make_ulong", referenced from:
      __hh_get_memory_size in hdr_histogram_nif.o
      __hh_get_total_count in hdr_histogram_nif.o
  "_enif_open_resource_type", referenced from:
     _on_load in hdr_histogram_nif.o
  "_enif_priv_data", referenced from:
      __hh_open in hdr_histogram_nif.o
      __hh_get_memory_size in hdr_histogram_nif.o
      __hh_get_total_count in hdr_histogram_nif.o
      __hh_record in hdr_histogram_nif.o
     __hh_record_corrected in hdr_histogram_nif.o
      __hh_record_many in hdr_histogram_nif.o
      __hh_add in hdr_histogram_nif.o
      ...
  "_enif_release_resource", referenced from:
      __hh_open in hdr_histogram_nif.o
      __hh_from_binary in hdr_histogram_nif.o
      __hi_open in hdr_histogram_nif.o
  "_inflate", referenced from:
      _hdr_decode_compressed in hdr_histogram_log.o
  "_inflateEnd", referenced from:
      _hdr_decode_compressed in hdr_histogram_log.o
  "_inflateInit_", referenced from:
      _hdr_decode_compressed in hdr_histogram_log.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: *** [/.../customized_hdr_histogram/c_src/../priv/hdr_histogram_nif.so] Error 1
===> Hook for compile failed!
 
** (Mix) Could not compile dependency :customized_hdr_histogram, ...

@gomoripeti gomoripeti added this to 2.0 harder / should in Roadmap Oct 4, 2017
@gomoripeti gomoripeti moved this from 2.0 harder / should to Uni in Roadmap Oct 6, 2017
@gomoripeti gomoripeti added this to Fix stuff in Hackathon Nov 16, 2017
@karlseguin
Copy link

Someone linked this issue in Elixir's #general slack channel. I wrote https://github.com/2nd/histogrex a while ago, if it helps (pure Elixir HDR histogram)

@gomoripeti
Copy link
Collaborator

hi Karl,

thanks for bringing to our attention that someone had this issue. And even more for the pointer to your pure Elixir implementation.
Currently there is a requirement that we need to compile and run XProf in an env without Elixir, so cannot include your lib straight away, but it's a good starting point (maybe porting it to Erlang) and motivation to tackle this issue sooner rather than later.

@gomoripeti gomoripeti added this to the 2.0 milestone Dec 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Roadmap
  
Uni
Hackathon
  
Fix stuff
Development

No branches or pull requests

3 participants