Very strange - major leak, crashed mongrel

I made what I think is a small change yet the change in my app was
disastrous - cpu spun, memory went out of control, and mongrel crashed
within seconds.

I have a controller which takes a param for submission_id . Submissions
have 1 or more reviews, and reviews each have one image. There may be
than one image per submission.

The view (and partial) code does some very intense things, like @ | review |
, etc. No doubt causes huge joins and queries down the stack.

I built a query for a subset of the reviews belonging to @submission:
@current_reviews = Review.find(:all, :conditions => cond)

The query takes 20 milliseconds. [cond is along the lines of finding
max(id) where [email protected] group by image_id ]

Then when I try to loop thru these in view, replacing @ with @current_reviews.each , it leaks like
Same code works just fine w/

The partial that it’s rendering in that loop is huge - 150 lines of
with all kinds of join-inducing references. Why would this behavior be
different for a SUBSET ?

Thanks in advance for any insights, things to try, places to look, etc.



This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs