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

Regression: Hot lib reload, unable to find __rust_alloc. #2310

Closed
cheako opened this issue Aug 19, 2024 · 6 comments
Closed

Regression: Hot lib reload, unable to find __rust_alloc. #2310

cheako opened this issue Aug 19, 2024 · 6 comments

Comments

@cheako
Copy link

cheako commented Aug 19, 2024

I'm not great with ENGLISH, let me explain with a console log... It contains everything I know about the issue, output-image is the hot crate.

The second run is me not perfectly downgrading image and can be ignored. The things to note are the versions of hot-lib-reloader and image/imageproc/ravif/ect Only imager and it's descendants were changed.

I've maybe 500 lines of code, the project is basically 3days old and is only a skeliton of what's needed to get v4l images into face detection. I am planing on drawing something with the tenserflow output and wanted to not have to reload NNs on every change.

cheako@mx1:~/src/gitlab/arbane$ cargo run
   Compiling cfg-if v1.0.0
   Compiling libm v0.2.8
   Compiling adler v1.0.2
   Compiling num-traits v0.2.19
   Compiling log v0.4.22
   Compiling memchr v2.7.4
   Compiling minimal-lexical v0.2.1
   Compiling bitflags v1.3.2
   Compiling byteorder v1.5.0
   Compiling anyhow v1.0.86
   Compiling built v0.7.4
   Compiling arrayvec v0.7.6
   Compiling aligned-vec v0.5.0
   Compiling profiling-procmacros v1.0.15
   Compiling itertools v0.12.1
   Compiling crc32fast v1.4.2
   Compiling libloading v0.8.5
   Compiling filetime v0.2.24
   Compiling miniz_oxide v0.7.4
   Compiling sha2 v0.10.8
   Compiling getrandom v0.2.15
   Compiling maybe-rayon v0.1.1
   Compiling half v2.4.1
   Compiling aes v0.8.4
   Compiling sha1 v0.10.6
   Compiling num-derive v0.4.2
   Compiling arg_enum_proc_macro v0.3.4
   Compiling simd_helpers v0.1.0
   Compiling bitstream-io v2.5.0
   Compiling clang-sys v1.8.1
   Compiling once_cell v1.19.0
   Compiling noop_proc_macro v0.3.0
   Compiling rand_core v0.6.4
   Compiling new_debug_unreachable v1.0.6
   Compiling rav1e v0.7.1
   Compiling imgref v1.10.1
   Compiling zerocopy v0.7.35
   Compiling profiling v1.0.15
   Compiling quick-error v2.0.1
   Compiling tar v0.4.41
   Compiling avif-serialize v0.8.1
   Compiling rgb v0.8.48
   Compiling jpeg-decoder v0.3.1
   Compiling byteorder-lite v0.1.0
   Compiling pbkdf2 v0.11.0
   Compiling loop9 v0.1.5
   Compiling zune-core v0.4.12
   Compiling image-webp v0.1.3
   Compiling flate2 v1.0.31
   Compiling gif v0.13.1
   Compiling inotify v0.9.6
   Compiling parking_lot_core v0.9.10
   Compiling mio v0.8.11
   Compiling qoi v0.4.1
   Compiling exr v1.72.0
   Compiling zune-jpeg v0.4.13
   Compiling nom v7.1.3
   Compiling ppv-lite86 v0.2.20
   Compiling notify v6.1.1
   Compiling parking_lot v0.12.3
   Compiling png v0.17.13
   Compiling tiff v0.9.1
   Compiling rand_chacha v0.3.1
   Compiling notify-debouncer-full v0.3.1
   Compiling num-integer v0.1.46
   Compiling v_frame v0.3.8
   Compiling num-complex v0.4.6
   Compiling num-bigint v0.4.6
   Compiling approx v0.5.1
   Compiling zip v0.6.6
   Compiling cexpr v0.6.0
   Compiling rand v0.8.5
   Compiling num-iter v0.1.45
   Compiling hot-lib-reloader v0.7.0
   Compiling bindgen v0.65.1
   Compiling simba v0.8.1
   Compiling rand_distr v0.4.3
   Compiling tensorflow-sys v0.24.0
   Compiling num-rational v0.4.2
   Compiling av1-grain v0.2.3
   Compiling num v0.4.3
   Compiling tensorflow v0.21.0
   Compiling v4l2-sys-mit v0.3.0
   Compiling nalgebra v0.32.6
   Compiling ravif v0.11.10
   Compiling v4l v0.14.0
   Compiling image v0.25.2
   Compiling imageproc v0.25.0
   Compiling output-image v0.0.1 (/home/cheako/src/gitlab/arbane/output-image)
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/cheako/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/cheako/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/home/cheako/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/cheako/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/home/cheako/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/cheako/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/home/cheako/.cargo/bin:/home/cheako/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" VSLANG="1033" "cc" "-Wl,--version-script=/tmp/rustcguVl6U/list" "-Wl,--no-undefined-version" "-m64" "/tmp/rustcguVl6U/symbols.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.0bip5swwc9nljtjehpo1g37lw.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.0howbm7ecf16s8ruinaq9llz8.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.0itzt67gui1t90ywfcprloijx.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.0jmu4eo955asc3yt8pnzlh34p.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.0tt8kwouq48qaoycq0c55qmvo.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.11x9msfeymv14ify1t8nvnv25.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.18egojmiz8xcu30uxzry0ynac.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.1kxmdtqq84tyllfln7kprr90v.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.1tx9g5oglyb2k5q45vbi2o4ol.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.1ue17e3oqy3une54n5b1ve8s6.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.20dv7shomwag3f4rmx3wxme51.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.23m0z0xiyug0bxf2i5j3ruqbf.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.28jxab9bomkukki9e9q0lyoku.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.2j6kwbbdn5uo9fs5s65p1kbko.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.2lhqniaw4lys5h6lzl5qbbb0t.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.33r029yo9ngbzc1wiv2125zeg.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.3euw4nooqcueey9yu3yuwc0kn.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.3r8k14450vk7e1qozmq6c9t1d.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.3we4bldnkas6errxt07fwir6h.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.3zvkjy8mfo8je64sxs6u50g7k.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.43e3g4v0tpn5906dqgpvnisfq.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.43nuzjarhjjxuqiy6vb73b5it.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.495114fzwhovu28yq6u6awmkz.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.4qsup5mrruwac7kve86n2nthq.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.51pfwj3xgpfd9opss4jt334kv.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.5j0zmd9tnfh0uranpteaod78p.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.5x1qsqb77jertu95bv5tb1ya3.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.711cthmgvg86p3m4h12py80s9.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.72j9w073nbrb3f4ew99cit9mo.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.737etmf8kwslvmi2r48rl2ub8.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.7ngxgh4ke433037dr5rv866bh.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/deps/output_image.7uga1zr8ld8yi0bej46bt771g.rcgu.o" "/home/cheako/src/gitlab/arbane/target/debug/dep
  = note: rust-lld: error: version script assignment of 'global' to symbol '__rust_alloc' failed: symbol not defined
          rust-lld: error: version script assignment of 'global' to symbol '__rust_alloc_error_handler' failed: symbol not defined
          rust-lld: error: version script assignment of 'global' to symbol '__rust_alloc_error_handler_should_panic' failed: symbol not defined
          rust-lld: error: version script assignment of 'global' to symbol '__rust_alloc_zeroed' failed: symbol not defined
          rust-lld: error: version script assignment of 'global' to symbol '__rust_dealloc' failed: symbol not defined
          rust-lld: error: version script assignment of 'global' to symbol '__rust_no_alloc_shim_is_unstable' failed: symbol not defined
          rust-lld: error: version script assignment of 'global' to symbol '__rust_realloc' failed: symbol not defined
          collect2: error: ld returned 1 exit status
          

error: could not compile `output-image` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
cheako@mx1:~/src/gitlab/arbane$ cargo run
    Blocking waiting for file lock on build directory
   Compiling cfg-if v1.0.0
   Compiling adler v1.0.2
   Compiling bitflags v1.3.2
   Compiling byteorder v1.5.0
   Compiling log v0.4.22
   Compiling crc32fast v1.4.2
   Compiling libloading v0.8.5
   Compiling filetime v0.2.24
   Compiling sha2 v0.10.8
   Compiling getrandom v0.1.16
   Compiling half v2.4.1
   Compiling aes v0.8.4
   Compiling miniz_oxide v0.7.4
   Compiling sha1 v0.10.6
   Compiling inotify v0.9.6
   Compiling parking_lot_core v0.9.10
   Compiling clang-sys v1.8.1
   Compiling tar v0.4.41
   Compiling rand_core v0.5.1
   Compiling mio v0.8.11
   Compiling zerocopy v0.7.35
   Compiling pbkdf2 v0.11.0
   Compiling parking_lot v0.12.3
   Compiling flate2 v1.0.31
   Compiling exr v1.72.0
   Compiling notify v6.1.1
   Compiling ppv-lite86 v0.2.20
   Compiling zip v0.6.6
   Compiling png v0.17.13
   Compiling tiff v0.9.1
   Compiling notify-debouncer-full v0.3.1
   Compiling bindgen v0.65.1
   Compiling rand_chacha v0.2.2
   Compiling hot-lib-reloader v0.7.0
   Compiling rand v0.7.3
   Compiling image v0.24.9
   Compiling tensorflow-sys v0.24.0
   Compiling rand_distr v0.2.2
   Compiling tensorflow v0.21.0
   Compiling imageproc v0.23.0
   Compiling v4l2-sys-mit v0.3.0
   Compiling v4l v0.14.0
   Compiling output-image v0.1.0 (/home/cheako/src/gitlab/arbane/output-image)
error[E0308]: arguments to this function are incorrect
  --> output-image/src/lib.rs:68:21
   |
68 |                     draw_text_mut(
   |                     ^^^^^^^^^^^^^
...
73 |                         font_scale,
   |                         ---------- expected `Scale`, found `f32`
74 |                         &font,
   |                         ----- expected `&Font<'_>`, found `&FontArc`
   |
   = note: expected reference `&rusttype::font::Font<'_>`
              found reference `&FontArc`
note: function defined here
  --> /home/cheako/.cargo/registry/src/index.crates.io-6f17d22bba15001f/imageproc-0.23.0/src/drawing/text.rs:45:8
   |
45 | pub fn draw_text_mut<'a, C>(
   |        ^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0308`.
error: could not compile `output-image` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
cheako@mx1:~/src/gitlab/arbane$ cargo run
   Compiling cfg-if v1.0.0
   Compiling adler v1.0.2
   Compiling bitflags v1.3.2
   Compiling byteorder v1.5.0
   Compiling log v0.4.22
   Compiling crc32fast v1.4.2
   Compiling libloading v0.8.5
   Compiling filetime v0.2.24
   Compiling sha2 v0.10.8
   Compiling getrandom v0.1.16
   Compiling aes v0.8.4
   Compiling half v2.4.1
   Compiling sha1 v0.10.6
   Compiling inotify v0.9.6
   Compiling parking_lot_core v0.9.10
   Compiling miniz_oxide v0.7.4
   Compiling tar v0.4.41
   Compiling clang-sys v1.8.1
   Compiling mio v0.8.11
   Compiling pbkdf2 v0.11.0
   Compiling parking_lot v0.12.3
   Compiling zerocopy v0.7.35
   Compiling rand_core v0.5.1
   Compiling flate2 v1.0.31
   Compiling exr v1.72.0
   Compiling notify v6.1.1
   Compiling zip v0.6.6
   Compiling notify-debouncer-full v0.3.1
   Compiling ppv-lite86 v0.2.20
   Compiling png v0.17.13
   Compiling tiff v0.9.1
   Compiling hot-lib-reloader v0.7.0
   Compiling bindgen v0.65.1
   Compiling rand_chacha v0.2.2
   Compiling tensorflow-sys v0.24.0
   Compiling rand v0.7.3
   Compiling image v0.24.9
   Compiling tensorflow v0.21.0
   Compiling rand_distr v0.2.2
   Compiling v4l2-sys-mit v0.3.0
   Compiling imageproc v0.23.0
   Compiling v4l v0.14.0
   Compiling output-image v0.1.0 (/home/cheako/src/gitlab/arbane/output-image)
   Compiling arbane v0.0.1 (/home/cheako/src/gitlab/arbane)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 16.21s
     Running `target/debug/arbane`
[src/v4l.rs:16:55] i = 1
thread '<unnamed>' panicked at /home/cheako/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hot-lib-reloader-0.7.0/src/lib_reloader.rs:206:51:
creating notify debouncer: Error { kind: Io(Os { code: 24, kind: Uncategorized, message: "Too many open files" }), paths: [] }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2024-08-18 22:43:34.381559: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-08-18 22:43:34.385826: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:375] MLIR V1 optimization pass is not enabled
2024-08-18 22:43:34.449500: W tensorflow/core/grappler/costs/op_level_cost_estimator.cc:693] Error in PredictCost() for the op: op: "CropAndResize" attr { key: "T" value { type: DT_FLOAT } } attr { key: "extrapolation_value" value { f: 0 } } attr { key: "method" value { s: "bilinear" } } inputs { dtype: DT_FLOAT shape { dim { size: 1 } dim { size: -28 } dim { size: -29 } dim { size: 3 } } } inputs { dtype: DT_FLOAT shape { dim { size: -13 } dim { size: 4 } } } inputs { dtype: DT_INT32 shape { dim { size: -13 } } } inputs { dtype: DT_INT32 shape { dim { size: 2 } } value { dtype: DT_INT32 tensor_shape { dim { size: 2 } } int_val: 24 } } device { type: "CPU" vendor: "AuthenticAMD" model: "241" frequency: 3699 num_cores: 12 environment { key: "cpu_instruction_set" value: "AVX SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2" } environment { key: "eigen" value: "3.4.90" } l1_cache_size: 32768 l2_cache_size: 524288 l3_cache_size: 33554432 memory_size: 268435456 } outputs { dtype: DT_FLOAT shape { dim { size: -13 } dim { size: 24 } dim { size: 24 } dim { size: 3 } } }
2024-08-18 22:43:34.449977: W tensorflow/core/grappler/costs/op_level_cost_estimator.cc:693] Error in PredictCost() for the op: op: "CropAndResize" attr { key: "T" value { type: DT_FLOAT } } attr { key: "extrapolation_value" value { f: 0 } } attr { key: "method" value { s: "bilinear" } } inputs { dtype: DT_FLOAT shape { dim { size: 1 } dim { size: -28 } dim { size: -29 } dim { size: 3 } } } inputs { dtype: DT_FLOAT shape { dim { size: -22 } dim { size: 4 } } } inputs { dtype: DT_INT32 shape { dim { size: -22 } } } inputs { dtype: DT_INT32 shape { dim { size: 2 } } value { dtype: DT_INT32 tensor_shape { dim { size: 2 } } int_val: 48 } } device { type: "CPU" vendor: "AuthenticAMD" model: "241" frequency: 3699 num_cores: 12 environment { key: "cpu_instruction_set" value: "AVX SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2" } environment { key: "eigen" value: "3.4.90" } l1_cache_size: 32768 l2_cache_size: 524288 l3_cache_size: 33554432 memory_size: 268435456 } outputs { dtype: DT_FLOAT shape { dim { size: -22 } dim { size: 48 } dim { size: 48 } dim { size: 3 } } }
thread 'main' panicked at src/main.rs:22:14:
not yet implemented
@fintelia fintelia closed this as not planned Won't fix, can't repro, duplicate, stale Aug 25, 2024
@cheako
Copy link
Author

cheako commented Aug 25, 2024

Yes, I'm well aware you didn't plan on removing this...

@fintelia
Copy link
Contributor

Your error has nothing to do with this library. If you want general Rust help you should ask on https://users.rust-lang.org or some other help forum

@cheako
Copy link
Author

cheako commented Aug 25, 2024

The difference is the version of image used... I don't get how you can claim the error has nothing to do when the the error has everything to do with the version of image used.

The fact is your upgrade breaks things for random other libraries.

@HeroicKatora
Copy link
Member

HeroicKatora commented Aug 25, 2024

Agree with @fintelia here. The symbol __rust_alloc and related failure is definitely introduced in the Rust standard library for your target and has nothing to do with image. No linker configuration is happening at all; and nothing related to this has been changed across the versions. If you may, it's probably one of these issues and related to what looks like using nightly Rust (guessing from the PATH in the log). We don't support that anyways.

The supposed reproduction is not minimal and can't be followed either, it's not clear what's being changed in the log or what source code there would be for reproduction. This comment explains a difference in exposed symbols when compiling Rust libraries. Maybe it applies, maybe it doesn't. Sorry, but that's not something we can track in this issue tracker.

@cheako
Copy link
Author

cheako commented Aug 30, 2024

Thanks for helping me identify the cause... I'm trying not to read into what you are saying improperly. I should try and use image v0.24.9 with an upgraded std? However, I don't see std in the list of things being compiled. Are you sure that's the cause? I had guessed that your team would remember making a change that could cause something like this, but if bisecting image is the best way to locate that change, that's good to know. I do fully support reassigning this to the correct crate, but I don't think it's wise to make guesses as to what that is.

@fintelia
Copy link
Contributor

If you want help figuring out what component is causing the bug in your code, you should ask in a general Rust help forum.

I'm going to go ahead and lock this issue

@image-rs image-rs locked and limited conversation to collaborators Aug 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants