Skip to content

Instantly share code, notes, and snippets.

@headius
Created June 9, 2017 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save headius/752eb916bd3a9d39f2574a5a5f06d1f5 to your computer and use it in GitHub Desktop.
Save headius/752eb916bd3a9d39f2574a5a5f06d1f5 to your computer and use it in GitHub Desktop.
Crash in tensorflow using FFI API to replace ext in somaticio/tensorflow.rb
~/projects/tensorflow.rb $ LD_LIBRARY_PATH=~/tensorflow/lib ruby -Ilib image/classify_image.rb image/mysore_palace.jpg
Trying to classify image file: image/mysore_palace.jpg
/Users/headius/projects/tensorflow.rb/lib/tensorflow/graph.rb:197: [BUG] Segmentation fault at 0x00000000000000
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
for more details.
Don't forget to include the above Crash Report log file in bug reports.
-- Control frame information -----------------------------------------------
c:0009 p:---- s:0077 e:000076 CFUNC :set_attr_tensor
c:0008 p:0643 s:0069 e:000068 METHOD /Users/headius/projects/tensorflow.rb/lib/tensorflow/graph.rb:197
c:0007 p:0016 s:0055 e:000054 BLOCK /Users/headius/projects/tensorflow.rb/lib/tensorflow/graph.rb:115 [FINISH]
c:0006 p:---- s:0050 e:000049 CFUNC :each
c:0005 p:0237 s:0046 e:000045 METHOD /Users/headius/projects/tensorflow.rb/lib/tensorflow/graph.rb:114
c:0004 p:0076 s:0035 e:000034 METHOD /Users/headius/projects/tensorflow.rb/lib/tensorflow/scope.rb:26
c:0003 p:0075 s:0029 e:000028 METHOD /Users/headius/projects/tensorflow.rb/lib/tensorflow/op.rb:14
c:0002 p:0131 s:0021 E:002178 EVAL image/classify_image.rb:52 [FINISH]
c:0001 p:0000 s:0003 E:0012c0 (none) [FINISH]
-- Ruby level backtrace information ----------------------------------------
image/classify_image.rb:52:in `<main>'
/Users/headius/projects/tensorflow.rb/lib/tensorflow/op.rb:14:in `Const'
/Users/headius/projects/tensorflow.rb/lib/tensorflow/scope.rb:26:in `AddOperation'
/Users/headius/projects/tensorflow.rb/lib/tensorflow/graph.rb:114:in `AddOperation'
/Users/headius/projects/tensorflow.rb/lib/tensorflow/graph.rb:114:in `each'
/Users/headius/projects/tensorflow.rb/lib/tensorflow/graph.rb:115:in `block in AddOperation'
/Users/headius/projects/tensorflow.rb/lib/tensorflow/graph.rb:197:in `set_attributes'
/Users/headius/projects/tensorflow.rb/lib/tensorflow/graph.rb:197:in `set_attr_tensor'
-- Machine register context ------------------------------------------------
rax: 0x0000000000000000 rbx: 0xc000000000000000 rcx: 0x00007fb89c07f560
rdx: 0x00007fb89c06faa0 rdi: 0xc000000000000008 rsi: 0x0000000000000000
rbp: 0x00007fff5497f6c0 rsp: 0x00007fff5497f6c0 r8: 0x00007fff5497f7c0
r9: 0x000000010b43fdee r10: 0x00007fff5497f6d0 r11: 0x00000001112c2450
r12: 0x00007fb89c07f560 r13: 0x588501ae2dc700ff r14: 0x00007fb89c07f560
r15: 0x0000000000000000 rip: 0x00007fffbb359990 rfl: 0x0000000000010286
-- C level backtrace information -------------------------------------------
0 ruby 0x000000010b445504 rb_vm_bugreport + 132
1 ruby 0x000000010b2e48b3 rb_bug_context + 467
2 ruby 0x000000010b3c4b68 sigsegv + 72
3 libsystem_platform.dylib 0x00007fffbc999b3a _sigtramp + 26
4 libc++.1.dylib 0x00007fffbb359990 _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED1Ev + 4
5 libtensorflow.dylib 0x0000000112b3e541 _ZN10tensorflow6Status12SlowCopyFromEPKNS0_5StateE + 33
6 libtensorflow.dylib 0x00000001112c248d TF_SetAttrTensor + 61
7 ffi_c.bundle 0x000000010b729c94 ffi_call_unix64 + 76
8 ffi_c.bundle 0x000000010b729022 ffi_call + 1074
9 ffi_c.bundle 0x000000010b71dced rbffi_CallFunction + 221
10 ffi_c.bundle 0x000000010b721809 custom_trampoline + 25
11 ruby 0x000000010b439520 vm_call_cfunc + 272
12 ruby 0x000000010b423f50 vm_exec_core + 11504
13 ruby 0x000000010b4342c4 vm_exec + 116
14 ruby 0x000000010b440d75 invoke_block_from_c_splattable + 485
15 ruby 0x000000010b42f79a rb_yield_values2 + 74
16 ruby 0x000000010b31221c each_pair_i_fast + 44
17 ruby 0x000000010b311583 hash_foreach_iter + 51
18 ruby 0x000000010b3ce9f6 st_general_foreach + 662
19 ruby 0x000000010b30ac92 hash_foreach_call + 34
20 ruby 0x000000010b2ee724 rb_ensure + 164
21 ruby 0x000000010b30e62a rb_hash_each_pair + 154
22 ruby 0x000000010b439520 vm_call_cfunc + 272
23 ruby 0x000000010b423846 vm_exec_core + 9702
24 ruby 0x000000010b4342c4 vm_exec + 116
25 ruby 0x000000010b2ed688 ruby_exec_internal + 136
26 ruby 0x000000010b2ed5a6 ruby_run_node + 54
27 ruby 0x000000010b28035f main + 79
-- Other runtime information -----------------------------------------------
* Loaded script: image/classify_image.rb
* Loaded features:
0 enumerator.so
1 thread.rb
2 rational.so
3 complex.so
4 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/x86_64-darwin16/enc/encdb.bundle
5 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/x86_64-darwin16/enc/trans/transdb.bundle
6 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/unicode_normalize.rb
7 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/x86_64-darwin16/rbconfig.rb
8 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/compatibility.rb
9 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/defaults.rb
10 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/deprecate.rb
11 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/errors.rb
12 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/version.rb
13 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/requirement.rb
14 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/platform.rb
15 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/basic_specification.rb
16 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/stub_specification.rb
17 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/util/list.rb
18 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/x86_64-darwin16/stringio.bundle
19 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/specification.rb
20 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/exceptions.rb
21 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/dependency.rb
22 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_gem.rb
23 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/monitor.rb
24 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb
25 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems.rb
26 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/path_support.rb
27 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/version.rb
28 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/core_ext/name_error.rb
29 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/levenshtein.rb
30 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/jaro_winkler.rb
31 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/spell_checker.rb
32 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/2.4.0/delegate.rb
33 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb
34 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb
35 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/spell_checkers/name_error_checkers.rb
36 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/spell_checkers/method_name_checker.rb
37 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/spell_checkers/null_checker.rb
38 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/formatter.rb
39 /Users/headius/.rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean.rb
40 /Users/headius/.gem/ruby/2.4.1/gems/ffi-1.9.18/lib/ffi_c.bundle
41 /Users/headius/.gem/ruby/2.4.1/gems/ffi-1.9.18/lib/ffi/platform.rb
42 /Users/headius/.gem/ruby/2.4.1/gems/ffi-1.9.18/lib/ffi/types.rb
43 /Users/headius/.gem/ruby/2.4.1/gems/ffi-1.9.18/lib/ffi/library.rb
44 /Users/headius/.gem/ruby/2.4.1/gems/ffi-1.9.18/lib/ffi/errno.rb
45 /Users/headius/.gem/ruby/2.4.1/gems/ffi-1.9.18/lib/ffi/pointer.rb
46 /Users/headius/.gem/ruby/2.4.1/gems/ffi-1.9.18/lib/ffi/memorypointer.rb
47 /Users/headius/.gem/ruby/2.4.1/gems/ffi-1.9.18/lib/ffi/struct_layout_builder.rb
48 /Users/headius/.gem/ruby/2.4.1/gems/ffi-1.9.18/lib/ffi/struct.rb
49 /Users/headius/.gem/ruby/2.4.1/gems/ffi-1.9.18/lib/ffi/union.rb
50 /Users/headius/.gem/ruby/2.4.1/gems/ffi-1.9.18/lib/ffi/managedstruct.rb
51 /Users/headius/.gem/ruby/2.4.1/gems/ffi-1.9.18/lib/ffi/callback.rb
52 /Users/headius/.gem/ruby/2.4.1/gems/ffi-1.9.18/lib/ffi/io.rb
53 /Users/headius/.gem/ruby/2.4.1/gems/ffi-1.9.18/lib/ffi/autopointer.rb
54 /Users/headius/.gem/ruby/2.4.1/gems/ffi-1.9.18/lib/ffi/variadic.rb
55 /Users/headius/.gem/ruby/2.4.1/gems/ffi-1.9.18/lib/ffi/enum.rb
56 /Users/headius/.gem/ruby/2.4.1/gems/ffi-1.9.18/lib/ffi/ffi.rb
57 /Users/headius/.gem/ruby/2.4.1/gems/ffi-1.9.18/lib/ffi.rb
58 /Users/headius/projects/tensorflow.rb/lib/tensorflow/tensorflow_api.rb
59 /Users/headius/projects/tensorflow.rb/lib/tensorflow/tensorflow_wrap.rb
60 /Users/headius/projects/tensorflow.rb/lib/tensorflow/opspec.rb
61 /Users/headius/projects/tensorflow.rb/lib/tensorflow/tensor.rb
62 /Users/headius/projects/tensorflow.rb/lib/tensorflow/graph.rb
63 /Users/headius/projects/tensorflow.rb/lib/tensorflow/session.rb
64 /Users/headius/projects/tensorflow.rb/lib/tensorflow/session_options.rb
65 /Users/headius/projects/tensorflow.rb/lib/tensorflow/status.rb
66 /Users/headius/projects/tensorflow.rb/lib/tensorflow/operation.rb
67 /Users/headius/projects/tensorflow.rb/lib/tensorflow/savedmodel.rb
68 /Users/headius/projects/tensorflow.rb/lib/tensorflow/scope.rb
69 /Users/headius/projects/tensorflow.rb/lib/tensorflow/op.rb
70 /Users/headius/projects/tensorflow.rb/lib/tensorflow.rb
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
[IMPORTANT]
Don't forget to include the Crash Report log file under
DiagnosticReports directory in bug reports.
Abort trap: 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment