Skip to content

TString.scalarOf core dumps on OSX #320

@jakeri

Description

@jakeri

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): OSX 11.3.1 (intel)
  • TensorFlow installed from (source or binary): binary TF Java 0.3.1 and 0.4.0-SNAPSHOT
  • TensorFlow version (use command below): 2.4.1 as built with TF Java 0.3.1
  • CUDA/cuDNN version: No
  • GPU model and memory: No

Describe the current behavior

Calling TString.scalarOf("hello"); will core dump on OSX. It will actually succeed 1 out of 10 times.

Describe the expected behavior

I want to be able to create a TString without a core dump.

Code to reproduce the issue

JUnit test

    @Test
    public void testTString() throws Exception {
        TString.scalarOf("hello");
    }

Other info / logs

Running same test case through docker linux vm succeeds.

One core dump from a run:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00000001422d724c, pid=16660, tid=5635
#
# JRE version: OpenJDK Runtime Environment (11.0.2+9) (build 11.0.2+9)
# Java VM: OpenJDK 64-Bit Server VM (11.0.2+9, mixed mode, tiered, compressed oops, g1 gc, bsd-amd64)
# Problematic frame:
# C  [libtensorflow_cc.2.dylib+0x822924c]  tensorflow::TensorInterface::ByteSize() const+0xc
#
# Core dump will be written. Default location: /cores/core.16660
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  S U M M A R Y ------------

Command Line: /Users/jakob/proj/tfjava031/target/surefire/surefirebooter11868128427691651602.jar /Users/jakob/proj/tfjava031/target/surefire/surefire16140580774728156639tmp /Users/jakob/proj/tfjava031/target/surefire/surefire_012592081837142384420tmp

Host: MacBookPro13,2 x86_64 3100 MHz, 4 cores, 16G, Darwin 20.4.0
Time: Tue May 11 11:47:43 2021 CEST elapsed time: 3 seconds (0d 0h 0m 3s)

---------------  T H R E A D  ---------------

Current thread (0x00007fb48f809000):  JavaThread "main" [_thread_in_native, id=5635, stack(0x00007000053f2000,0x00007000054f2000)]

Stack: [0x00007000053f2000,0x00007000054f2000],  sp=0x00007000054eeea8,  free space=1011k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libtensorflow_cc.2.dylib+0x822924c]  tensorflow::TensorInterface::ByteSize() const+0xc
j  org.tensorflow.internal.buffer.TensorBuffers.tensorMemory(Lorg/tensorflow/internal/c_api/TF_Tensor;)Lorg/bytedeco/javacpp/Pointer;+5
j  org.tensorflow.internal.buffer.TensorBuffers.toStrings(Lorg/tensorflow/internal/c_api/TF_Tensor;J)Lorg/tensorflow/internal/buffer/ByteSequenceTensorBuffer;+1
j  org.tensorflow.internal.types.TStringMapper.mapDense(Lorg/tensorflow/RawTensor;)Lorg/tensorflow/types/TString;+11
j  org.tensorflow.internal.types.TStringMapper.mapDense(Lorg/tensorflow/RawTensor;)Lorg/tensorflow/types/family/TType;+2
j  org.tensorflow.RawTensor.asTypedTensor()Lorg/tensorflow/types/family/TType;+8
j  org.tensorflow.Tensor.of(Ljava/lang/Class;Lorg/tensorflow/ndarray/Shape;J)Lorg/tensorflow/types/family/TType;+10
j  org.tensorflow.Tensor.of(Ljava/lang/Class;Lorg/tensorflow/ndarray/Shape;JLjava/util/function/Consumer;)Lorg/tensorflow/types/family/TType;+3
j  org.tensorflow.types.TString.tensorOf(Ljava/nio/charset/Charset;Lorg/tensorflow/ndarray/NdArray;)Lorg/tensorflow/types/TString;+28
j  org.tensorflow.types.TString.tensorOf(Lorg/tensorflow/ndarray/NdArray;)Lorg/tensorflow/types/TString;+4
j  org.tensorflow.types.TString.scalarOf(Ljava/lang/String;)Lorg/tensorflow/types/TString;+4
j  com.peltarion.tf.test.JakobTest.testTString()V+2
v  ~StubRoutines::call_stub
V  [libjvm.dylib+0x39b736]  JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x21a
V  [libjvm.dylib+0x64c917]  invoke(InstanceKlass*, methodHandle const&, Handle, bool, objArrayHandle, BasicType, objArrayHandle, bool, Thread*)+0x4e6
V  [libjvm.dylib+0x64c3e7]  Reflection::invoke_method(oopDesc*, Handle, objArrayHandle, Thread*)+0xf5
V  [libjvm.dylib+0x42236d]  JVM_InvokeMethod+0x20a
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions