rowland / fb

Firebird Extension Library for Ruby
64 stars 35 forks source link

Ruby 2.0.0(x64) Segmentation fault #70

Open filipeaugustosantos opened 4 years ago

filipeaugustosantos commented 4 years ago

I have an application that runs under Ruby 2.0.0-p648 (x64). After configuring Devkit (x64), installing Firebird 2.5 (x64): I successfully install the gem.

But by running the simple test: require 'fb' include Fb db = Database.new( :database => "localhost:d:/readme.fdb", :username => 'sysdba', :password => 'masterkey') conn = db.connect rescue db.create.connect

I get the following generic error: conn = db.connect ... [BUG] Segmentation fault #38 The error also happens in a clean install of the measured versions.

If I do the same steps however everything on x86 (Ruby 2.0.0-p648 (x86), Devkit (x86), Firebird 2.5 (x86)) the code runs normally. I've checked in many ways for the correct DLL installed on each version of Firebird.

Today I can't upgrade Ruby as there is a large application running with this specific version.

Any suggestions on how to make it work? Thank you.

rowland commented 4 years ago

The architecture of your Ruby interpreter and your Firebird library must agree. If you are successful connecting from an x86 Ruby, then your fbclient.dll must also be for x86. In order to connect from an x64 Ruby, you will need an x64 fbclient.dll.

filipeaugustosantos commented 4 years ago

The architecture of your Ruby interpreter and your Firebird library must agree. If you are successful connecting from an x86 Ruby, then your fbclient.dll must also be for x86. In order to connect from an x64 Ruby, you will need an x64 fbclient.dll.

Right. However I did the installation of Firebird (x64) and used its dll. If I use Ruby + Devkit 2.6.3-1 (x64) and follow the same steps, it works. However in version 2.0.0 no. I tested with the SysWOW64 and System32 dll, tested copying to the bin folder ... and nothing. I believe it is correct because the gem was compiled, if I have a version of Firebird at odds with Ruby, the gem is not compiled.

I am wrong? @rowland

filipeaugustosantos commented 4 years ago

__fb.rb:7: [BUG] Segmentation fault ruby 2.0.0p648 (2015-12-16) [x64-mingw32]

-- Control frame information ----------------------------------------------- c:0003 p:---- s:0010 e:000009 CFUNC :connect c:0002 p:0054 s:0007 E:001ee0 EVAL __fb.rb:7 [FINISH] c:0001 p:0000 s:0002 E:001638 TOP [FINISH]

fb.rb:7:in `

' fb.rb:7:in `connect'

-- C level backtrace information ------------------------------------------- C:\WINDOWS\SYSTEM32\ntdll.dll(ZwWaitForSingleObject+0x14) [0x00007FFED513C0E4] C:\WINDOWS\System32\KERNELBASE.dll(WaitForSingleObjectEx+0x93) [0x00007FFED2098BA3] C:\Users\Filipe\Desktop\ECM\ScanDesigner\Ruby\bin\x64-msvcrt-ruby200.dll(rb_vm_bugreport+0x9d) [0x000000006F287B2D] C:\Users\Filipe\Desktop\ECM\ScanDesigner\Ruby\bin\x64-msvcrt-ruby200.dll(rb_name_err_mesg_new+0x838) [0x000000006F1422D8] C:\Users\Filipe\Desktop\ECM\ScanDesigner\Ruby\bin\x64-msvcrt-ruby200.dll(rb_bug+0x45) [0x000000006F143085] C:\Users\Filipe\Desktop\ECM\ScanDesigner\Ruby\bin\x64-msvcrt-ruby200.dll(rb_check_safe_str+0x3c1) [0x000000006F20BF21] [0x0000000000401A85] C:\WINDOWS\System32\msvcrt.dll(_C_specific_handler+0x98) [0x00007FFED4128048] C:\WINDOWS\SYSTEM32\ntdll.dll(_chkstk+0x11f) [0x00007FFED514119F] C:\WINDOWS\SYSTEM32\ntdll.dll(RtlRaiseException+0x399) [0x00007FFED510A229] C:\WINDOWS\SYSTEM32\ntdll.dll(KiUserExceptionDispatcher+0x2e) [0x00007FFED513FE0E] C:\Users\Filipe\Desktop\ECM\ScanDesigner\Ruby\lib\ruby\gems\2.0.0\gems\fb-0.9.2\fb.so(Init_fb+0xc90) [0x0000000066D89010] [0x0000000066D83E93] C:\Users\Filipe\Desktop\ECM\ScanDesigner\Ruby\bin\x64-msvcrt-ruby200.dll(rb_error_arity+0x125) [0x000000006F272615] C:\Users\Filipe\Desktop\ECM\ScanDesigner\Ruby\bin\x64-msvcrt-ruby200.dll(rb_f_send+0x5a1) [0x000000006F2817C1] C:\Users\Filipe\Desktop\ECM\ScanDesigner\Ruby\bin\x64-msvcrt-ruby200.dll(rb_vm_localjump_error+0x1cf8) [0x000000006F276D08] C:\Users\Filipe\Desktop\ECM\ScanDesigner\Ruby\bin\x64-msvcrt-ruby200.dll(rb_vm_localjump_error+0x5bf9) [0x000000006F27AC09] C:\Users\Filipe\Desktop\ECM\ScanDesigner\Ruby\bin\x64-msvcrt-ruby200.dll(rb_iseq_eval_main+0x1e0) [0x000000006F284CA0] C:\Users\Filipe\Desktop\ECM\ScanDesigner\Ruby\bin\x64-msvcrt-ruby200.dll(rb_check_copyable+0x3287) [0x000000006F148047] C:\Users\Filipe\Desktop\ECM\ScanDesigner\Ruby\bin\x64-msvcrt-ruby200.dll(ruby_run_node+0x51) [0x000000006F14A8C1] [0x0000000000402D14] [0x00000000004013D7] [0x00000000004014F8] C:\WINDOWS\System32\KERNEL32.DLL(BaseThreadInitThunk+0x14) [0x00007FFED3247BD4]

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

  • Loaded script: __fb.rb

  • Loaded features:

    0 enumerator.so 1 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/x64-mingw32/enc/encdb.so 2 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/x64-mingw32/enc/iso_8859_1.so 3 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/x64-mingw32/enc/trans/transdb.so 4 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/x64-mingw32/rbconfig.rb 5 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/rubygems/compatibility.rb 6 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/rubygems/defaults.rb 7 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/rubygems/deprecate.rb 8 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/rubygems/errors.rb 9 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/rubygems/version.rb 10 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/rubygems/requirement.rb 11 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/rubygems/platform.rb 12 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/rubygems/specification.rb 13 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/rubygems/exceptions.rb 14 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/rubygems/defaults/operating_system.rb 15 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/x64-mingw32/enc/utf_16le.so 16 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/x64-mingw32/enc/trans/utf_16_32.so 17 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb 18 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/thread.rb 19 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/monitor.rb 20 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb 21 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/rubygems.rb 22 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/rubygems/path_support.rb 23 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/rubygems/dependency.rb 24 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/x64-mingw32/bigdecimal.so 25 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/x64-mingw32/date_core.so 26 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/date/format.rb 27 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/date.rb 28 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/time.rb 29 C:/Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/gems/2.0.0/gems/fb-0.9.2/fb.so

[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

WITH THE OTHER DLL:

% 1 is not a valid Win32 application. - C: /Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/gems/2.0.0/gems/fb-0.9.2/fb.so (LoadError)          from C: /Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb: 135: in rescue in require '          from C: /Users/Filipe/Desktop/ECM/ScanDesigner/Ruby/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb: 144: inrequire '          from __fb.rb: 1: in `

'

rowland commented 4 years ago

Unfortunately, compiling is not a sure sign of anything, save that ibase.h was present.

You might try version 0.9.1. Version 0.9.2 accommodated some BigDecimal deprecations in 2.6.3. 0.9.2 still works on older Rubies on Unix, but Windows was not tested for regressions.

filipeaugustosantos commented 4 years ago

Unfortunately, compiling is not a sure sign of anything, save that ibase.h was present.

You might try version 0.9.1. Version 0.9.2 accommodated some BigDecimal deprecations in 2.6.3. 0.9.2 still works on older Rubies on Unix, but Windows was not tested for regressions.

Thanks for the answer, however I tested on 0.9.1 through 0.7.0 and it doesn't work on x64 :(...