Bugs: Browse | Submit New | Admin

[#26791] DBD-Mysql: statement.rb:130: [BUG] Segmentation fault

Date:
2009-07-29 21:24
Priority:
3
Submitted By:
Nobody
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
DBD-Mysql: statement.rb:130: [BUG] Segmentation fault

Detailed description
Hey.

I'm trying to use the ODBC (DBI/DBD-MySQL) to get values from a MySQL db.
The MySQL server is running ok and everything was working using MySQL driver instead of DBI/DBD-MySQL.

My code is:
require "rubygems"
gem "dbi"
require "dbi"

dbh = DBI.connect("DBI:Mysql:host=x.x.x.x;port=3306;database=db", "#{MYSQL_USER}",
"#{MYSQL_PASSWD}")
res = dbh.execute('select * from TABLE order by ID asc')

If I put:
require "rubygems"
gem "dbi"
require "dbi"

I got the following message:
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
C:/ruby/lib/ruby/gems/1.8/gems/dbd-mysql-0.4.3/lib/dbd/mysql/statement.rb:130: [BUG] Segmentation fault
ruby 1.8.6 (2007-03-13) [i386-mswin32]

And If I put only
require "dbi"

I got the message:
Could not load driver (uninitialized constant Mysql::Driver)

I'm using WinXP and the MySQL is on a solaris 5.10.
C:\>gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.3
  - RUBY VERSION: 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
  - INSTALLATION DIRECTORY: c:/ruby/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: c:/ruby/bin/ruby.exe
  - EXECUTABLE DIRECTORY: c:/ruby/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-mswin32-60
  - GEM PATHS:
     - c:/ruby/lib/ruby/gems/1.8
     - C:/Documents and Settings/hrodrigues/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://gems.rubyforge.org/

And I installed dbi and dbd-mysql using gem install.

Does anybody can help me?

-Helio

Add A Comment: Notepad

Please login


Followup

Message
Date: 2010-11-02 03:19
Sender: Edward Stembler

I'm getting the same error on Mac OS X 1.6 (64bit Snow Leopard)
using Actual Technologies's SQL Server ODBC driver.  The error
seems to be prevalent on Unix too according to Google searching.

Ruby 1.9.2 provides more error information:


    /dbd-odbc-0.2.5/lib/dbd/odbc/statement.rb:41: [BUG] Segmentation
fault
    ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10]

    -- control frame ----------
    c:0006 p:---- s:0022 b:0022 l:000021 d:000021 CFUNC  :fetch
    c:0005 p:0014 s:0019 b:0018 l:000017 d:000017 METHOD
/dbd-odbc-0.2.5/lib/dbd/odbc/statement.rb:41
    c:0004 p:0139 s:0014 b:0014 l:000013 d:000013 METHOD
/dbi-0.4.5/lib/dbi/handles/statement.rb:220
    c:0003 p:0102 s:0009 b:0009 l:001588 d:001c30 EVAL 
ss_dbi.rb:7
    c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
    c:0001 p:0000 s:0002 b:0002 l:001588 d:001588 TOP  
    ---------------------------
    -- Ruby level backtrace information
----------------------------------------
    ss_dbi.rb:7:in `<main>'
    /dbi-0.4.5/lib/dbi/handles/statement.rb:220:in `fetch'
    /dbd-odbc-0.2.5/lib/dbd/odbc/statement.rb:41:in `fetch'
    /dbd-odbc-0.2.5/lib/dbd/odbc/statement.rb:41:in `fetch'

    -- C level backtrace information
-------------------------------------------

    [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

    Abort trap


I'm not used to reading the above error dump, however I'm wondering
if CFUNC means the error is originating from the 3rd-party ODBC
driver which happens to be written in C.  Or, is this just some
C library ruby is using?  That seems to be as far as I can take
it.
Date: 2009-09-13 19:54
Sender: Erik Hollensbe

Ok folks, using the latest 32-bit 5.1 client, the ruby 1.8.6
one-click installer, dbi 0.4.2, dbd-mysql 0.4.3 and mysql 2.8.1
gems, I cannot recreate this. This exact script runs just fine.

Since there were so many reports of this I'll leave it open for
a month, but please, PLEASE check your installations.
Date: 2009-09-13 18:56
Sender: Erik Hollensbe

Looking at this now; sorry to make you guys wait so long, new
job + moving across country means I had to put these kinds of
things on hold. Will try to get back to you on this later today.
Date: 2009-08-25 08:52
Sender: Stefan Hausch

I've the same Problem.
MySQL 5.1.37 on WinXP. My Table is UTF-8 and MyISAM.

My Ruby-Source:
---
require 'rubygems'
gem 'mysql'
gem 'dbi'
require 'dbi'
require 'mysql'

url = "DBI:Mysql:#{@@dbname}:#{@@dbsrv}"
@dbi = DBI.connect(url, @@dbuser, @@dbpassw)

results = @dbi.execute("SELECT * FROM table")
---

Gem Installation:

dbd-jdbc (0.0.5)
dbd-mysql (0.4.3)
dbd-odbc (0.2.5)
dbi (0.4.2)
deprecated (2.0.1)
fxri (0.3.6)
fxruby (1.6.19, 1.6.16)
hpricot (0.6.164)
log4r (1.0.5)
mysql (2.7.3)
ptools (1.1.6)
rake (0.8.7, 0.8.1)
rdoc (2.4.3)
ruby-opengl (0.60.0)
test-unit (2.0.1)
win32-api (1.2.1, 1.2.0)
win32-clipboard (0.4.4)
win32-dir (0.3.2)
win32-eventlog (0.5.0)
win32-file (0.5.5)
win32-file-stat (1.3.1)
win32-process (0.5.9)
win32-sapi (0.1.4)
win32-sound (0.4.1)
windows-api (0.2.4)
windows-pr (0.9.3)

----

I've got the segmentation fault when I select all or some special
fields of my table.
Also there is a problem to identifiy my VARCHAR-fields.

My primary key-field is ok as INT(10) and a Fixnum in Ruby. My
first VARCHAR(100) is only a Fixnum with 0 or 1 in the result
hash.

In statement.rb the method call fetch_fields produces the
exception.

@res_handle is type of Mysql::Result but I cant't find any RDoc
or Source of it.

Date: 2009-07-30 13:31
Sender: Helio Rodrigues

Good morning all.
I reported this bug yesterday and I still could not figured out
what's the problem.

I tried many solutions and did everything described on the following
links:
http://www.kitebird.com/articles/ruby-dbi.html
http://ruby-dbi.rubyforge.org/rdoc/index.html

Does anybody can help me?
--Helio

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item