Closed bf4 closed 2 weeks ago
Rails 7.0.6 Rollbar 3.4.0 jruby 9.4.3.0 ruby 3.1.4
We experienced the same thing. We can't create a minimal example to reproduce the issue but we got around it with this patch.
Rollbar::Notifier.class_eval do
def use_exception_level_filters?(options)
option_value = options && options[:use_exception_level_filters]
return option_value unless option_value.nil?
configuration.use_exception_level_filters_default
end
end
The difference is options[:use_exception_level_filters]
vs options.delete(:use_exception_level_filters)
https://github.com/rollbar/rollbar-gem/blob/master/lib/rollbar/notifier.rb#L409
These args are passed to Rollbar.log. At this point extra
is a hash.
[1] pry(#<Rollbar::Notifier>)> extra
=> {:use_exception_level_filters=>true}
[2] pry(#<Rollbar::Notifier>)> extra.class
=> Hash
After use_exception_level_filters? is called extra
returns a weird error.
[1] pry(#<Rollbar::Notifier>)> extra
ArgumentError: wrong number of arguments (given 0, expected 1)
from /usr/local/rvm/gems/default/gems/pry-0.14.2-java/lib/pry/ring.rb:43:in `<<'
Caused by RuntimeError: foo
from /workspaces/Profile/app/controllers/name_controller.rb:8:in `edit'
[2] pry(#<Rollbar::Notifier>)> extra.class
=> Hash
When ignore_before_process?
is called it's with extra
it produces this error.
[1] pry(#<Rollbar::Notifier>)> ignore_before_process?(level, exception, message, extra)
ArgumentError: wrong number of arguments (given 3, expected 4)
from /usr/local/rvm/gems/default/gems/rollbar-3.4.0/lib/rollbar/notifier.rb:158:in `ignore_before_process?'
Caused by RuntimeError: foobar
from /workspaces/Profile/app/controllers/name_controller.rb:8:in `edit'
When plugging in the actual value all is good.
[2] pry(#<Rollbar::Notifier>)> ignore_before_process?(level, exception, message, {:use_exception_level_filters=>true})
=> false
Side note: The method use_exception_level_filters?
is a bit misleading as it also mutates the options.
While many consider avoiding mutation of method arguments preferable, this bug appears to be rooted in a Jruby issue. I've submitted Unexpected ArgumentError calling Forwardable delegated single splat method with keyword arguments
Thanks for getting this fixed in JRuby!
I can't tell what causes this since it's internal code to rollbar which looks fine. Sharing in case this happens to anyone else.
JRuby 9.4.1.0, ruby 3.1.0
backtrace