#30 ✓resolved
Rein Henrichs

#find(nil) returns []

Reported by Rein Henrichs | October 27th, 2007 @ 02:22 PM

Zoo.find(nil).should == nil

Comments and changes to this ticket

  • Sam Smoot

    Sam Smoot October 27th, 2007 @ 05:36 PM

    • State changed from “new” to “open”
    • Milestone cleared.
  • Sam Smoot

    Sam Smoot October 28th, 2007 @ 07:47 PM

    Traced this to a bug in the do.rb mysql driver. There's a spec for it now. Hopefully fixed very soon. This is the last issue before 0.2.1. Everything else is ready to go...

  • Sam Smoot

    Sam Smoot October 29th, 2007 @ 02:34 AM

    Not fixed yet. :(

    After spending hours on this, all I know is a bunch of facts that make no sense. :(

    Like spec 1 runs, then 2, then 3. Spec 3 is getting a row returned by spec 1. But that row was consumed in spec 1, so that shouldn't be possible. You'd think that if any sort of leak were to occur it would be through adjacent specs, but that's not what's happening. You'd also think wrapping query execution with a Mutex would ensure that, but no difference. You'd think a block-form of DO::Mysql::Command#execute_reader would ensure that because the readers are guaranteed to be closed, they couldn't possibly bleed on each other, but they are. If all rows are guaranteed to be consumed before a reader closes, they shouldn't be able to bleed into the result sets of other readers right? But they do.

    And through all of this, the two MYSQL_RES (reader) instances that are interacting so poorly are actually different instances. I know, I've checked. So how does one reader instance return the rows of another guaranteed-to-be-freed reader?

    At this point, the only thing that makes any kind of sense to me is a bug in the generated swig bindings.

    My next step is to somehow try to reproduce this bug in the DO.rb specs, but that's a very daunting proposition since I can't identify anything about these two interacting specs that seems particularly unique. They're really a bit generic as far as what code-paths they'll be exercising. So out of 110 examples in the DM, only 2 fail. So yeah, not looking forward to trying to reproduce this with just DO.rb.

  • Sam Smoot

    Sam Smoot October 29th, 2007 @ 08:25 PM


    Sqlite3 decimates ActiveRecord: http://pastie.textmate.org/priva...


    So... there's that. Plus some extra benchmarking reveals the find_by_sql performance issues are localized to the DO::Mysql driver.

    So I think there's a very good chance this bug is related.

    So I think we'll see some progress on this soon. With the number of hours I've poured into this so far, I'm not promising anything at this point, especially not anything like "by tomorrow", but hopefully before the week's out.

  • Sam Smoot

    Sam Smoot November 2nd, 2007 @ 12:39 PM

    • State changed from “open” to “resolved”

    Resolved in r431.

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