New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NoMethodError: undefined method `visit_Arel_Nodes_Casted' for #<Arel::Visitors::DepthFirst:> #739
Comments
We had similar problems and believe it is related to the lack of thread safety in the rescue clause during a visit of an arel node; although not related to activerecord-jdbc it seems this issue is made more prevalent because of jruby threading The rails issue outlines the problem as seemingly only related to we haven't seen it happen since applying the below patch ... but we continue to monitor for it and watch for an update to arel to be able to remove our patch require "thread"
require "arel/visitors/visitor"
# NOTE: Fixing thread safety problems for Arel, hopefully can be removed in future
# https://github.com/rails/rails/issues/26571
module Arel
module Visitors
class Visitor
NO_METHOD_MUTEX = ::Mutex.new
def visit object
send dispatch[object.class], object
rescue NoMethodError => e
superklass = object.class.ancestors.find { |klass|
respond_to?(dispatch[klass], true)
}
raise(TypeError, "Cannot visit #{object.class}") unless superklass
NO_METHOD_MUTEX.synchronize do
dispatch[object.class] = dispatch[superklass] unless respond_to?(dispatch[object.class], true)
end
if respond_to?(dispatch[object.class], true)
retry
else
raise e
end
end
end
end
end |
I'm getting the same issue when running from a Sidekiq job. Was the above patch submitted as a PR to the Rails project? @abrandoned Here is the error
|
@prama10 the above linked PR into arel was merged in on June 4; if you have a more recent version it may be there but we actually have both patches applied on our systems so I'll have to verify if the PR merged fixed it for both cases (in our testing we thought it would) |
@abrandoned provided great HINTs on want the issue really is about, let's close it as invalid at AR-JDBC's |
I get this error when I try to run:
Game.where.not(score: [0,nil]).size
This is the stacktrace:
The text was updated successfully, but these errors were encountered: