#276 ✓resolved
Camilo Lopez

do_mysql segfaults (not sure why)

Reported by Camilo Lopez | May 12th, 2008 @ 11:06 AM

Comments and changes to this ticket

  • Camilo Lopez

    Camilo Lopez May 12th, 2008 @ 11:15 AM

    I'm getting:

    /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.0/lib/data_mapper/adapters/data_objects_adapter.rb:278: [BUG] Segmentation fault

    ruby 1.8.6 (2007-09-24) [i486-linux]

    Aborted

    When running

    require 'rubygems'

    require 'test/unit'

    require 'merb-core'

    Merb.start_environment :testing => false,

    :environment => (ENV['MERB_ENV'] || 'test'),

    :adapter => 'runner'

    class FooModel

    include DataMapper::Resource

    property :bar, String

    def self.find_by_bar(value)

    self.first(:bar => value)

    end

    def self.find_all_by_bar(value)

    self.all(:bar => value)

    end

    end

    class TestFoo < Test::Unit::TestCase

    def test_

    FooModel.find_by_bar('baz')

    end

    end

    The table foo_models does not exist so this should be a Mysql Error

    I know the problem is in do_mysql /ext/o_mysql_ext.c

    at some point in cConnection_initialize the actual connection object is being lost and a NULL pointer gets passed to cCommand_execute_reader causing the Seg Fault.

    These are the relevant gems I'm using:

    data_objects (0.9.0)

    datamapper (0.3.2)

    do_mysql (0.9.0)

    merb_datamapper (0.9.3)

    validatable (1.6.7)

  • Sam Smoot

    Sam Smoot May 13th, 2008 @ 01:34 PM

    • State changed from “new” to “invalid”
    • Assigned user changed from “Sam Smoot” to “Adam French”

    DO 0.9.0 is only compatible with DM 0.9.0. DM 0.3.2 shouldn't even be able to require DO 0.9.0 I thought since we should be using gem 'data_objects', '<= 3.0.0'. :-/

    Adam, can you verify that in SVN?

  • Camilo Lopez

    Camilo Lopez May 13th, 2008 @ 01:50 PM

    Oops, I made a mistake in the list of gems I have both DM versions installed

    (0.3.2 and 0.9.0). I've been looking a little more into this today.

    At some point in data_objects/connection.rb the pointer to the actual mysql

    connection is 'lost', this is what I get using ruby-debugger

    /usr/lib/ruby/gems/1.8/gems/data_objects-0.9.0/lib/data_objects/connection.rb:54

    @reserved_connections << conn

    (rdb:1) l

    [49, 58] in

    /usr/lib/ruby/gems/1.8/gems/data_objects-0.9.0/lib/data_objects/connection.rb

    49 conn = allocate

    50 conn.send(:initialize, connection_uri)

    51 at_exit { conn.real_close }

    52 end

    53

    => 54 @reserved_connections << conn

    55 end

    56

    57 return conn

    58 end

    (rdb:1) pp conn

    #

    @concrete_command=DataObjects::Mysql::Command,

    @connection=nil,

    @uri=

    #

    mailagiodev:mailagiodev@192.168.0.201/defensio_test_camilo>,

    @using_socket=false>

    notice the @connection = nil

    On Tue, May 13, 2008 at 2:35 PM, Lighthouse

    wrote:

  • Sam Smoot

    Sam Smoot May 13th, 2008 @ 02:57 PM

    • State changed from “invalid” to “open”
    • Assigned user changed from “Adam French” to “Scott Bauer”

    Ah, Scott? Any ideas?

  • Carl

    Carl May 24th, 2008 @ 11:25 PM

    +1

    seems like an important bug to fix before a release... Any chance it will make it for the 0.9 release?

  • Sam Smoot

    Sam Smoot June 10th, 2008 @ 10:07 PM

    • State changed from “open” to “resolved”

    New pooling with scavenging is pushed. Marking this as resolved. It'll be a part of 0.9.2 if you're not already on edge.

  • Carl

    Carl June 11th, 2008 @ 04:35 PM

    We can confirm that segfaults are gone. Thanks for taking care of this!

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Pages