jarmo / RAutomation

RAutomation
MIT License
100 stars 33 forks source link

adapter/win_32/functions.rb:298: [BUG] Segmentation fault #121

Closed Nakilon closed 5 years ago

Nakilon commented 6 years ago

Just installed Ruby to code a bit on Windows. Using the gem win32screenshot I've got a segfault (https://github.com/jarmo/win32screenshot/issues/26) and I suppose this is how that gem invokes your gem:

require "rautomation"
RAutomation::Window.new({context: :window, title: "Friends"}).active?
C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adapter/wi
n_32/functions.rb:298: [BUG] Segmentation fault
ruby 2.4.4p296 (2018-03-28 revision 63013) [i386-mingw32]

-- Control frame information -----------------------------------------------
c:0009 p:---- s:0043 e:000042 CFUNC  :enum_windows
c:0008 p:0068 s:0037 E:00065c METHOD C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomat
ion-0.17.0/lib/rautomation/adapter/win_32/functions.rb:298
c:0007 p:0011 s:0028 E:002174 METHOD C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomat
ion-0.17.0/lib/rautomation/adapter/win_32/functions.rb:140
c:0006 p:0031 s:0023 e:000022 METHOD C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomat
ion-0.17.0/lib/rautomation/adapter/win_32/window.rb:48
c:0005 p:0008 s:0019 e:000018 METHOD C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomat
ion-0.17.0/lib/rautomation/adapter/win_32/window.rb:90
c:0004 p:0008 s:0014 e:000013 METHOD C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomat
ion-0.17.0/lib/rautomation/adapter/win_32/window.rb:80
c:0003 p:0010 s:0010 e:000009 METHOD C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomat
ion-0.17.0/lib/rautomation/window.rb:124
c:0002 p:0030 s:0006 e:000005 EVAL   main.rb:2 [FINISH]
c:0001 p:0000 s:0003 E:001850 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------
main.rb:2:in `<main>'
C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/window.rb:
124:in `active?'
C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adapter/wi
n_32/window.rb:80:in `active?'
C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adapter/wi
n_32/window.rb:90:in `exists?'
C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adapter/wi
n_32/window.rb:48:in `hwnd'
C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adapter/wi
n_32/functions.rb:140:in `window_hwnd'
C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adapter/wi
n_32/functions.rb:298:in `find_hwnd'
C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adapter/wi
n_32/functions.rb:298:in `enum_windows'

-- C level backtrace information -------------------------------------------
C:\Windows\SysWOW64\ntdll.dll(NtWaitForSingleObject+0x15) [0x77aff8e1]
C:\Windows\syswow64\kernel32.dll(WaitForSingleObjectEx+0x43) [0x76b51194]
C:\Windows\syswow64\kernel32.dll(WaitForSingleObject+0x12) [0x76b51148]
C:\Ruby24\bin\msvcrt-ruby240.dll(rb_print_backtrace+0x40) [0x710f82b0]
C:\Windows\SysWOW64\ntdll.dll(RtlKnownExceptionFilter+0xb7) [0x77b55b57]

-- Other runtime information -----------------------------------------------

* Loaded script: main.rb

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 C:/Ruby24/lib/ruby/2.4.0/i386-mingw32/enc/encdb.so
    5 C:/Ruby24/lib/ruby/2.4.0/i386-mingw32/enc/trans/transdb.so
    6 C:/Ruby24/lib/ruby/2.4.0/i386-mingw32/enc/windows_1251.so
    7 C:/Ruby24/lib/ruby/2.4.0/unicode_normalize.rb
    8 C:/Ruby24/lib/ruby/2.4.0/i386-mingw32/rbconfig.rb
    9 C:/Ruby24/lib/ruby/2.4.0/rubygems/compatibility.rb
   10 C:/Ruby24/lib/ruby/2.4.0/rubygems/defaults.rb
   11 C:/Ruby24/lib/ruby/2.4.0/rubygems/deprecate.rb
   12 C:/Ruby24/lib/ruby/2.4.0/rubygems/errors.rb
   13 C:/Ruby24/lib/ruby/2.4.0/rubygems/version.rb
   14 C:/Ruby24/lib/ruby/2.4.0/rubygems/requirement.rb
   15 C:/Ruby24/lib/ruby/2.4.0/rubygems/platform.rb
   16 C:/Ruby24/lib/ruby/2.4.0/rubygems/basic_specification.rb
   17 C:/Ruby24/lib/ruby/2.4.0/rubygems/stub_specification.rb
   18 C:/Ruby24/lib/ruby/2.4.0/rubygems/util/list.rb
   19 C:/Ruby24/lib/ruby/2.4.0/i386-mingw32/stringio.so
   20 C:/Ruby24/lib/ruby/2.4.0/uri/rfc2396_parser.rb
   21 C:/Ruby24/lib/ruby/2.4.0/uri/rfc3986_parser.rb
   22 C:/Ruby24/lib/ruby/2.4.0/uri/common.rb
   23 C:/Ruby24/lib/ruby/2.4.0/uri/generic.rb
   24 C:/Ruby24/lib/ruby/2.4.0/uri/ftp.rb
   25 C:/Ruby24/lib/ruby/2.4.0/uri/http.rb
   26 C:/Ruby24/lib/ruby/2.4.0/uri/https.rb
   27 C:/Ruby24/lib/ruby/2.4.0/uri/ldap.rb
   28 C:/Ruby24/lib/ruby/2.4.0/uri/ldaps.rb
   29 C:/Ruby24/lib/ruby/2.4.0/uri/mailto.rb
   30 C:/Ruby24/lib/ruby/2.4.0/uri.rb
   31 C:/Ruby24/lib/ruby/2.4.0/rubygems/specification.rb
   32 C:/Ruby24/lib/ruby/2.4.0/rubygems/exceptions.rb
   33 C:/Ruby24/lib/ruby/site_ruby/2.4.0/ruby_installer/runtime/singleton.rb
   34 C:/Ruby24/lib/ruby/site_ruby/2.4.0/ruby_installer/runtime.rb
   35 C:/Ruby24/lib/ruby/site_ruby/2.4.0/ruby_installer/runtime/msys2_installati
on.rb
   36 C:/Ruby24/lib/ruby/2.4.0/i386-mingw32/fiddle.so
   37 C:/Ruby24/lib/ruby/2.4.0/fiddle/function.rb
   38 C:/Ruby24/lib/ruby/2.4.0/fiddle/closure.rb
   39 C:/Ruby24/lib/ruby/2.4.0/fiddle.rb
   40 C:/Ruby24/lib/ruby/site_ruby/2.4.0/ruby_installer/runtime/dll_directory.rb

   41 C:/Ruby24/lib/ruby/2.4.0/i386-mingw32/enc/utf_16le.so
   42 C:/Ruby24/lib/ruby/2.4.0/i386-mingw32/enc/trans/utf_16_32.so
   43 C:/Ruby24/lib/ruby/2.4.0/rubygems/defaults/operating_system.rb
   44 C:/Ruby24/lib/ruby/2.4.0/rubygems/dependency.rb
   45 C:/Ruby24/lib/ruby/2.4.0/rubygems/core_ext/kernel_gem.rb
   46 C:/Ruby24/lib/ruby/2.4.0/monitor.rb
   47 C:/Ruby24/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb
   48 C:/Ruby24/lib/ruby/2.4.0/rubygems.rb
   49 C:/Ruby24/lib/ruby/2.4.0/rubygems/path_support.rb
   50 C:/Ruby24/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/ver
sion.rb
   51 C:/Ruby24/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/cor
e_ext/name_error.rb
   52 C:/Ruby24/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/lev
enshtein.rb
   53 C:/Ruby24/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/jar
o_winkler.rb
   54 C:/Ruby24/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/spe
ll_checker.rb
   55 C:/Ruby24/lib/ruby/2.4.0/delegate.rb
   56 C:/Ruby24/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/spe
ll_checkers/name_error_checkers/class_name_checker.rb
   57 C:/Ruby24/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/spe
ll_checkers/name_error_checkers/variable_name_checker.rb
   58 C:/Ruby24/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/spe
ll_checkers/name_error_checkers.rb
   59 C:/Ruby24/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/spe
ll_checkers/method_name_checker.rb
   60 C:/Ruby24/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/spe
ll_checkers/null_checker.rb
   61 C:/Ruby24/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean/for
matter.rb
   62 C:/Ruby24/lib/ruby/gems/2.4.0/gems/did_you_mean-1.1.0/lib/did_you_mean.rb
   63 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/wait
_helper.rb
   64 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adap
ter/helper.rb
   65 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/butt
on.rb
   66 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/text
_field.rb
   67 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/elem
ent_collections.rb
   68 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/wind
ow.rb
   69 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation.rb
   70 C:/Ruby24/lib/ruby/gems/2.4.0/gems/ffi-1.9.23-x86-mingw32/lib/2.4/ffi_c.so

   71 C:/Ruby24/lib/ruby/gems/2.4.0/gems/ffi-1.9.23-x86-mingw32/lib/ffi/platform
.rb
   72 C:/Ruby24/lib/ruby/gems/2.4.0/gems/ffi-1.9.23-x86-mingw32/lib/ffi/types.rb

   73 C:/Ruby24/lib/ruby/gems/2.4.0/gems/ffi-1.9.23-x86-mingw32/lib/ffi/library.
rb
   74 C:/Ruby24/lib/ruby/gems/2.4.0/gems/ffi-1.9.23-x86-mingw32/lib/ffi/errno.rb

   75 C:/Ruby24/lib/ruby/gems/2.4.0/gems/ffi-1.9.23-x86-mingw32/lib/ffi/pointer.
rb
   76 C:/Ruby24/lib/ruby/gems/2.4.0/gems/ffi-1.9.23-x86-mingw32/lib/ffi/memorypo
inter.rb
   77 C:/Ruby24/lib/ruby/gems/2.4.0/gems/ffi-1.9.23-x86-mingw32/lib/ffi/struct_l
ayout_builder.rb
   78 C:/Ruby24/lib/ruby/gems/2.4.0/gems/ffi-1.9.23-x86-mingw32/lib/ffi/struct.r
b
   79 C:/Ruby24/lib/ruby/gems/2.4.0/gems/ffi-1.9.23-x86-mingw32/lib/ffi/union.rb

   80 C:/Ruby24/lib/ruby/gems/2.4.0/gems/ffi-1.9.23-x86-mingw32/lib/ffi/manageds
truct.rb
   81 C:/Ruby24/lib/ruby/gems/2.4.0/gems/ffi-1.9.23-x86-mingw32/lib/ffi/callback
.rb
   82 C:/Ruby24/lib/ruby/gems/2.4.0/gems/ffi-1.9.23-x86-mingw32/lib/ffi/io.rb
   83 C:/Ruby24/lib/ruby/gems/2.4.0/gems/ffi-1.9.23-x86-mingw32/lib/ffi/autopoin
ter.rb
   84 C:/Ruby24/lib/ruby/gems/2.4.0/gems/ffi-1.9.23-x86-mingw32/lib/ffi/variadic
.rb
   85 C:/Ruby24/lib/ruby/gems/2.4.0/gems/ffi-1.9.23-x86-mingw32/lib/ffi/enum.rb
   86 C:/Ruby24/lib/ruby/gems/2.4.0/gems/ffi-1.9.23-x86-mingw32/lib/ffi/ffi.rb
   87 C:/Ruby24/lib/ruby/gems/2.4.0/gems/ffi-1.9.23-x86-mingw32/lib/ffi.rb
   88 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adap
ter/win_32/constants.rb
   89 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adap
ter/win_32/keys.rb
   90 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adap
ter/win_32/functions.rb
   91 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adap
ter/win_32/locators.rb
   92 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adap
ter/win_32/window.rb
   93 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adap
ter/win_32/button_helper.rb
   94 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adap
ter/win_32/control.rb
   95 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adap
ter/win_32/button.rb
   96 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adap
ter/win_32/checkbox.rb
   97 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adap
ter/win_32/radio.rb
   98 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adap
ter/win_32/text_field.rb
   99 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adap
ter/win_32/select_list.rb
  100 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adap
ter/win_32/table.rb
  101 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adap
ter/win_32/label.rb
  102 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adap
ter/win_32/list_box.rb
  103 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adap
ter/win_32/mouse.rb
  104 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adap
ter/win_32/password_field.rb
  105 C:/Ruby24/lib/ruby/gems/2.4.0/gems/rautomation-0.17.0/lib/rautomation/adap
ter/win_32.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

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

Windows 7 Ruby Installer: Ruby+Devkit 2.4.4-1 (x86)

Nakilon commented 6 years ago
*** LOCAL GEMS ***

bigdecimal (default: 1.3.2)
did_you_mean (1.1.0)
ffi (1.9.23 x86-mingw32)
io-console (default: 0.4.6)
json (default: 2.0.4)
mini_magick (4.3.6)
minitest (5.10.1)
net-telnet (0.1.1)
openssl (default: 2.0.7)
power_assert (0.4.1)
psych (default: 2.2.2)
rake (12.0.0)
rautomation (0.17.0)
rdoc (default: 5.0.0)
test-unit (3.2.3)
win32screenshot (2.1.0)
xmlrpc (0.2.1)
Nakilon commented 6 years ago

Same for Ruby 2.2. Can't degrade Ruby further because of rubygems SSL issue.

leviwilson commented 6 years ago

@Nakilon try locking FFI between 1.9.4 and 1.9.18 as per https://github.com/northwoodspd/uia/issues/14

Nakilon commented 6 years ago

@leviwilson in related issue I wrote I tried 1.9.18, 1.9.17 and as far as I remember lower versions were throwing the same as 1.9.17 threw. I'll try again next time I get to Windows machine.