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

Java: SIGSEGV when Tensors.create-ing from an uninitialized array #17130

Closed
benmosher opened this issue Feb 19, 2018 · 1 comment
Closed

Java: SIGSEGV when Tensors.create-ing from an uninitialized array #17130

benmosher opened this issue Feb 19, 2018 · 1 comment
Assignees
Labels
stat:awaiting tensorflower Status - Awaiting response from tensorflower type:bug Bug

Comments

@benmosher
Copy link

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): yes
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
    macOS 10.13.3
    JRE version: Java(TM) SE Runtime Environment (8.0_121-b13) (build 1.8.0_121-b13)
  • TensorFlow installed from (source or binary): maven
    <dependency>
      <groupId>org.tensorflow</groupId>
      <artifactId>tensorflow</artifactId>
      <version>1.4.0</version>
    </dependency>
  • TensorFlow version (use command below): 1.4.0
  • Python version: N/A
  • Bazel version (if compiling from source): N/A
  • GCC/Compiler version (if compiling from source): N/A
  • CUDA/cuDNN version: N/A
  • GPU model and memory: N/A
  • Exact command to reproduce:
    // JUnit test case
    public void testSigSegv() {
        byte[][] bb = new byte[3][];  // note: new byte[3][1] doesn't crash, presumably it is initialized by the compile

        bb[0] = new byte[] { 0 };
        bb[1] = new byte[] { 1 };
        // no bb[2]

        // next line sigsegv's
        Tensors.create(bb);
    }

Describe the problem

Using Tensors.create to get a Tensor<String> from an uninitialized 2D byte array (byte[][]) results in a SIGSEGV from JNI. See full log below.

Source code / logs

When running the above test case, I get the following output.

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x000000010571f0b3, pid=30179, tid=0x0000000000001a03
#
# JRE version: Java(TM) SE Runtime Environment (8.0_121-b13) (build 1.8.0_121-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.121-b13 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.dylib+0x31f0b3]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/ben/AGLabs/nfl/JavaProjects/nlp/hs_err_pid30179.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

I'm not familiar enough with JNI in general to know if I'm expecting too much. I won't be surprised if you mark this wontfix, I was just surprised to be able to crash the process with a segfault given some bad data. Easy enough to work around (I will size/init my arrays more carefully) but thought you might want to know.

Cheers! Thanks so much for this library!

@asimshankar asimshankar self-assigned this Feb 19, 2018
@asimshankar
Copy link
Contributor

asimshankar commented Feb 19, 2018

Thanks very much for the report! Yes, this is indeed a bug (it should not be possible to cause the JVM to segfault when using the Java API :).

Will send a fix shortly.

@asimshankar asimshankar added type:bug Bug stat:awaiting tensorflower Status - Awaiting response from tensorflower labels Feb 19, 2018
@gunan gunan closed this as completed in 624a2e4 Feb 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting tensorflower Status - Awaiting response from tensorflower type:bug Bug
Projects
None yet
Development

No branches or pull requests

2 participants