Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

undefined method `render_partial_with_logging' for class `#<Class:0x617ead84>' org/jruby/RubyModule.java:2256:in `alias_method' #214

atambo opened this Issue Mar 2, 2012 · 15 comments


None yet
7 participants

atambo commented Mar 2, 2012

I'm getting:

undefined method `render_partial_with_logging' for class `#<Class:0x617ead84>'  org/jruby/RubyModule.java:2256:in `alias_method'

The backtrace:


Running jruby 1.6.7 with rails 3.2.2 and kaminari 0.13.0

atambo commented Mar 16, 2012

The #to_s method on Paginator aliases a method and then undefs the method it aliased which is not threadsafe. I am hitting the above exception when running kaminari in a threaded environment (jruby on rails application with config.threadsafe! uncommented in environment/production.rb). So one pagination request can come in and undef the render_partial_with_logging method while another request is about to alias the render_partial_with_logging method and then explode with the exception in the gist above.


jhund commented May 9, 2012

I keep getting this exception as well. Running jruby 1.6.7 with Rails 3.0.9 in multi threaded mode.

atambo commented May 9, 2012

@jhund, I ended up switching to https://github.com/mislav/will_paginate as that is threadsafe and has basically the same api.

jhund commented May 9, 2012

Thanks @atambo, will give that a try.

bwalsh commented Jul 21, 2012

Is this still an issue? Thinking about using it in rails 3.2 + jruby 1.6.7

atambo commented Jul 23, 2012

Yes this is still an issue. I suggest using https://github.com/mislav/will_paginate in a multi-threaded environment.

bwalsh commented Jul 26, 2012

Hmm. To bad. Any thought about this patch ?

see amatsuda#164

plentz commented Oct 31, 2012

same problem here. rails 3.2.8 + jruby 1.6.8 + multithread. related #164

Is there any problem to leave the render_partial_with_logging method on the subscriber, making it no more temporary?

Something like this:

      def to_s #:nodoc:
        subscriber = ActionView::LogSubscriber.log_subscribers.detect {|ls| ls.is_a? ActionView::LogSubscriber}
        return super @window_options.merge(@options).merge :paginator => self unless subscriber

        # dirty hack to suppress logging render_partial
        class << subscriber
          alias_method :render_partial_with_logging, :render_partial unless defined?(:render_partial_with_logging)
          # do nothing
          def render_partial(event); end

        ret = super @window_options.merge(@options).merge :paginator => self

        class << subscriber
          alias_method :render_partial, :render_partial_with_logging

It stills not being thread safe, and may miss something, but it will not cause any crash.


yuki24 commented Jun 18, 2013

I believe this issue solved by #374. Thanks!

@yuki24 yuki24 closed this Jun 18, 2013

I'm still having this issue using Rails 3.2.15 and jRuby 1.7.6.

Undefined method render_partial_with_logging for class '#<Class:0x76d7f01>' 
kaminari (0.14.1) lib/kaminari/helpers/paginator.rb:90:in `to_s' 

@fjyaniez can you check this on 0.15.0?

@gregoriokusowski I'll upgrade and try. Any method to force the error to appear?

Since the error happens when running a multi-threaded environment, it's kinda hard to force it.
You can use a tool like Apache Benchmark/etc to make a lot of parallel requests, but we can't assure that it will happen.

Ok I'll just update, do some tests and post here if the error happens again. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment