[BUG] Segfault Ruby 1.9.3-p194 using find_in_batches #318

Closed
mtchavez opened this Issue Nov 30, 2012 · 4 comments

3 participants

@mtchavez

I removed will-paginate from a project to use kaminari. However, I soon found ruby segfaults all over the place in our production environment.

The errors were consistent and each time produced the same output when trying to use ActiveRecord find_in_batches. The output would either be a segfault or a stack level too deep pointing to this line .../shared/bundle/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation/batches.rb:72

Not sure what the culprit is with kaminari but I removed it and placed will-paginate back in and I am able to use find_in_batches again. Let me know what else you need to help fix this, as I would much rather use kaminari over will-paginate.

Some environment details:

  • Ruby 1.9.3p194
  • MySQL 5.5.20
  • Ubuntu 12.04
  • MySQL2 gem v0.3.11
  • Tried on Rails 3.2.2 and 3.2.9
  • Kaminari gem v0.14.1
@yuki24
Collaborator

I'm sorry but I couldn't reproduce the problem, though I used MySQL 5.5.28 and Ubuntu 11.10.
Can you provide the exact code you are trying to run?

@mtchavez

The code that was specifically SEGFAULTing is this

account.widgets.find_in_batches do |widgets|
  for widget in widgets
    # Do stuff
  end
end

It made the first batch query intermittently but if it didn't SEGFAULT immediately it never was able to make the query for the second batch. In the above example there is an account_id on widgets that is associated with an account viahas_many widgets and widget belongs_to account. Nothing out of the ordinary there.

Again this was only in production that this occurred. It happened in both the console and when the code was called to be executed by cron. Let me know if you need any further details or what I can do to help.

@yuki24
Collaborator

Thank you @mtchavez!
I tried that in development so I'll try it over in production. If I can't reproduce, I'll set up an environment with MySQL 5.5.20 and Ubuntu 12.04. This takes time so please be patient. Thanks!

@zzak
Collaborator

This is a 3rd party issue, if you can reproduce please open a ticket.

@zzak zzak closed this Aug 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment