Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Memory problem on reset_session in around_filter

#1558

On rails-2.x. Memory usage would be increased and not be deallocated that on 'reset_session' in 'around_filter'.

For example, requesting so much to http://localhost:3000/foo/ using following controller on 'production' environment. Then, after all response, instances of CGI::Session or CgiRequest are deallocated from ObjectSpace, but, lots of instances of String (include session_id) will not be targeted by GC. However, using before/after filter, this problem is not occured.


class FooController < ApplicationController

  around_filter :bar

  def index
  end

  protected

  def bar
    reset_session
    yield
  end
end

thanks.

Reported by tmtysk · December 11th, 2008 @ 09:08 AM

State: committed
Milestone: none
Assigned to: josh josh
Importance: none

Activity

  1. Michael Koziarski
    Michael Koziarski
    • Assigned user set to josh
    • Milestone cleared.

    We'll need a fix for this in 2-2-stable as well as edge.

    December 11th, 2008 @ 11:46 AM

  2. Nick Sieger
    Nick Sieger

    FYI, JRuby doesn't appear to exhibit this memory leak. See http://skitch.com/nicksieger/68y... for a heap trace during a couple thousand requests against the above controller on JRuby.

    December 11th, 2008 @ 03:15 PM

  3. Frederick Cheung
  4. Repository
    Repository
    • State changed from new to resolved

    (from [5ede4ce188d29aef94af78f27d89169ac4ee54cd]) Fixed session related memory leak [#1558 Memory problem on reset_session in around_filter state:resolved]

    Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co...

    December 11th, 2008 @ 05:07 PM

  5. Jeremy Kemper
    Jeremy Kemper
    • State changed from resolved to open

    It wasn't committed to 2-2-stable or 2-1-stable.

    December 12th, 2008 @ 12:49 AM

  6. Repository
    Repository
    • State changed from open to resolved

    (from [bf0a8eb777ef7f796333b579329c5556f0bacc46]) Fixed session related memory leak [#1558 Memory problem on reset_session in around_filter state:resolved]

    Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co...

    December 15th, 2008 @ 05:52 PM

  7. Repository
    Repository

    (from [d0a3dbf5aa3d9105364556c9ec5847ab3ecacaf8]) Fixed session related memory leak [#1558 Memory problem on reset_session in around_filter state:resolved]

    Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co...

    December 15th, 2008 @ 05:53 PM

  8. josh
    josh
    • State changed from resolved to committed

    done.

    December 15th, 2008 @ 05:53 PM

  9. Stephen Bannasch
    Stephen Bannasch

    reverted on the 16th by Josh:

    http://github.com/rails/rails/co...

    No comment in the commit about why it was reverted.

    I was looking at this because of the use of ObjectSpace which is normally disabled for performance reasons in JRuby.

    December 27th, 2008 @ 04:07 PM

  10. Frederick Cheung
    Frederick Cheung

    Because this was only necessary due to finalizer related oddities in CGI::Session, edge no longer uses CGI::Session at all

    December 27th, 2008 @ 04:13 PM