Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
class_serial increment at each request #25068
Steps to reproduce
diff --git a/app/controllers/ruby_vm_controller.rb b/app/controllers/ruby_vm_controller.rb index 422b18b..6b438d0 100644 --- a/app/controllers/ruby_vm_controller.rb +++ b/app/controllers/ruby_vm_controller.rb @@ -1,4 +1,5 @@ class RubyVmController < ApplicationController def stat + render json: RubyVM.stat end end
Then run the server, access
In development, you have to warm the cache with one request first. Between the first and second requests,
class_serial should not change between requests
class_serial is incremented at each request
It was fine until beta3, and you start seeing this behaviour starting with beta4. I think 291a098 is what caused it to happen.
Using @tenderlove's patch to add the
There are three blocks that are called in this case:
Removing the first call to instance_exec by passing
diff --git a/activerecord/lib/active_record/query_cache.rb b/activerecord/lib/active_record/query_cache.rb index ca12a60..e6feb97 100644 --- a/activerecord/lib/active_record/query_cache.rb +++ b/activerecord/lib/active_record/query_cache.rb @@ -43,10 +43,12 @@ def self.complete(state) def self.install_executor_hooks(executor = ActiveSupport::Executor) executor.register_hook(self) - executor.to_complete do - unless ActiveRecord::Base.connection.transaction_open? - ActiveRecord::Base.clear_active_connections! - end + executor.to_complete(self) + end + + def self.before(_executor) + unless ActiveRecord::Base.connection.transaction_open? + ActiveRecord::Base.clear_active_connections! end end end
By displaying something inside the TracePoint, having a
Edit: forgot I also built an example app: https://github.com/etiennebarrie/class_serial
referenced this issue
Aug 17, 2016
I'm not crystal clear on what the incorrect behavior looks like. I've created some reproduction steps using rails' bug report templates (in guides/bug_report_templates/*).
Reproduction script is here: https://gist.github.com/rthbound/4a904c925bcc140ba9c669de5b54c407
So, at this time I'm not observing
Hope this helps.