Skip to content
This repository was archived by the owner on Mar 17, 2026. It is now read-only.
This repository was archived by the owner on Mar 17, 2026. It is now read-only.

Tests for tensorflow-sys fail #66

Closed

Description

Running cargo test in the tensorflow-sys directory fails (but tests pass for the main crate).

Here's the output:

 -> cd ~/tensorflow_rust.git/tensorflow-sys
 -> cargo test
    Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs
     Running target/debug/deps/tensorflow-9f5d1dac7e952430

running 12 tests
test buffer::tests::basic ... ok
test session::tests::smoke ... ok
test session::tests::test_close ... ok
test graph::tests::smoke ... ok
test tests::smoke ... ok
test tests::test_close ... ok
test tests::test_extend_graph ... ok
test session::tests::test_run ... ok
test tests::test_set_config ... ok
test tests::test_set_target ... ok
test tests::test_tensor ... ok
test tests::test_run ... ok

test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured

   Doc-tests tensorflow

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured

 -> cd tensorflow-sys/
 -> cargo test --verbose
       Fresh lazy_static v0.2.4
       Fresh regex-syntax v0.3.9
       Fresh pkg-config v0.3.9
       Fresh utf8-ranges v0.1.3
       Fresh libc v0.2.21
       Fresh winapi v0.2.8
       Fresh winapi-build v0.1.1
       Fresh memchr v0.1.11
       Fresh aho-corasick v0.5.3
       Fresh kernel32-sys v0.2.2
       Fresh thread-id v2.0.0
       Fresh thread_local v0.2.7
       Fresh regex v0.1.80
       Fresh semver-parser v0.6.2
       Fresh semver v0.5.1
       Fresh tensorflow-sys v0.7.0 (file:///home/nbigaouette/tensorflow_rust.git/tensorflow-sys)
    Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs
     Running `/home/nbigaouette/tensorflow_rust.git/target/debug/deps/lib-a517463cab98ea9f`

running 1 test
test linkage ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured

     Running `/home/nbigaouette/tensorflow_rust.git/target/debug/deps/tensorflow_sys-b18d6c19e08d67bd`
terminate called without an active exception
error: process didn't exit successfully: `/home/nbigaouette/tensorflow_rust.git/target/debug/deps/tensorflow_sys-b18d6c19e08d67bd` (signal: 6, SIGABRT: process abort signal)

Caused by:
  process didn't exit successfully: `/home/nbigaouette/tensorflow_rust.git/target/debug/deps/tensorflow_sys-b18d6c19e08d67bd` (signal: 6, SIGABRT: process abort signal)

Here's a backtrace from running /home/nbigaouette/tensorflow_rust.git/target/debug/deps/tensorflow_sys-b18d6c19e08d67bd through gdb:

Program received signal SIGABRT, Aborted.
0x00007ffff32f904f in raise () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff32f904f in raise () from /usr/lib/libc.so.6
#1  0x00007ffff32fa47a in abort () from /usr/lib/libc.so.6
#2  0x00007ffff2ccb4ed in __gnu_cxx::__verbose_terminate_handler () at /build/gcc/src/gcc/libstdc++-v3/libsupc++/vterminate.cc:95
#3  0x00007ffff2cc92a6 in __cxxabiv1::__terminate (handler=<optimized out>) at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:47
#4  0x00007ffff2cc92f1 in std::terminate () at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:57
#5  0x00007ffff2cc8062 in __cxxabiv1::__cxa_allocate_exception (thrown_size=136, thrown_size@entry=8) at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_alloc.cc:278
#6  0x00007ffff2cc9a98 in operator new (sz=32) at /build/gcc/src/gcc/libstdc++-v3/libsupc++/new_op.cc:54
#7  0x00007ffff57ab4c8 in tensorflow::monitoring::Counter<2>* tensorflow::monitoring::Counter<2>::New<char const (&) [46], char const (&) [58], char const (&) [11], char const (&) [7]>(char const (&) [46], char c
onst (&) [58], char const (&) [11], char const (&) [7]) () from /usr/lib/libtensorflow.so
#8  0x00007ffff571a50b in ?? () from /usr/lib/libtensorflow.so
#9  0x00007ffff7de94fa in call_init.part () from /lib64/ld-linux-x86-64.so.2
#10 0x00007ffff7de960b in _dl_init () from /lib64/ld-linux-x86-64.so.2
#11 0x00007ffff7ddadaa in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#12 0x0000000000000001 in ?? ()
#13 0x00007fffffffe846 in ?? ()
#14 0x0000000000000000 in ?? ()

Activity

  1. adamcrume commented on Mar 8, 2017

    @adamcrume
    Contributor

    We'll probably have to rope in a TensorFlow developer, because that stack trace looks like 100% C++.

  2. adamcrume commented on Mar 10, 2017

    @adamcrume
    Contributor

    Thanks for debugging; that's great detective work! And good idea using valgrind, we should add that as a test (#69).

    Unfortunately, this is a bit of a pickle. I don't want to require building with a nightly release, so changing the allocator in Rust is probably not an option. On the other hand, I'm trying to add support for prebuilt TensorFlow binaries (#65), and they seem to be built with jemalloc enabled.

    I'm also still lost on why the tests for the tensorflow crate are fine (except for a few leaked bytes, verified by valgrind), and the tests in tensorflow-sys/tests/lib.rs are fine, but the tests for the tensorflow_sys crate crash. Even if I add test functions in tensorflow-sys/src/lib.rs, it crashes before it runs my tests. (It seems to be crashing while loading libtensorflow.so.) What I would really like to know is whether users could be affected by this bug. If it means that we can't run tests in tensorflow-sys/src/lib.rs, then that's no big deal. If users are affected, then this has to be fixed somehow.

  3. lilianmoraru commented on Jun 4, 2017

    @lilianmoraru

    I expect tensorflow-sys to be shaky, especially on Windows.
    I wanted to see if there are docs for tensorflow-sys and observed that it uses bindgen, but the bindings are not generated at build.
    bindgen uses the current environment to define some of the variables.
    So, even on Linux you could have different values generating with glibc and musl(or any other libc implementation) for example.

    Throwing it out there that these issues might also appear because of this.

  4. adamcrume commented on Jul 29, 2017

    @adamcrume
    Contributor

    It looks like running rustup run nightly cargo test --verbose --lib -- --nocapture and cargo test on a clean checkout succeed now. Can you verify?

  5. ghost closed this as completedon Aug 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions