Skip to content
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 `find' for #<String:0x00000001198ffa60>) #20

Open
hrdwdmrbl opened this issue Jul 6, 2022 · 6 comments

Comments

@hrdwdmrbl
Copy link

NoMethodError (undefined method `find' for #<String:0x00000001198ffa60>):
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/rorvswild-1.5.13/lib/rorvswild/locator.rb:15:in `find_most_relevant_location'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/rorvswild-1.5.13/lib/rorvswild/locator.rb:10:in `find_most_relevant_file_and_line'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/rorvswild-1.5.13/lib/rorvswild/locator.rb:22:in `find_most_relevant_file_and_line_from_exception'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/rorvswild-1.5.13/lib/rorvswild/agent.rb:178:in `exception_to_hash'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/rorvswild-1.5.13/lib/rorvswild/agent.rb:111:in `push_exception'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/rorvswild-1.5.13/lib/rorvswild/agent.rb:77:in `rescue in measure_job'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/rorvswild-1.5.13/lib/rorvswild/agent.rb:76:in `measure_job'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/rorvswild-1.5.13/lib/rorvswild/plugin/active_job.rb:12:in `around_perform'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:126:in `instance_exec'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/i18n-1.10.0/lib/i18n.rb:323:in `with_locale'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activejob-6.1.6/lib/active_job/translation.rb:9:in `block (2 levels) in <module:Translation>'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:126:in `instance_exec'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/core_ext/time/zones.rb:66:in `use_zone'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activejob-6.1.6/lib/active_job/timezones.rb:9:in `block (2 levels) in <module:Timezones>'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:126:in `instance_exec'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activejob-6.1.6/lib/active_job/instrumentation.rb:21:in `block in instrument'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/notifications.rb:203:in `block in instrument'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/notifications.rb:203:in `instrument'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activejob-6.1.6/lib/active_job/instrumentation.rb:31:in `instrument'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activejob-6.1.6/lib/active_job/instrumentation.rb:14:in `block (2 levels) in <module:Instrumentation>'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:126:in `instance_exec'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activejob-6.1.6/lib/active_job/logging.rb:22:in `block in tag_logger'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/tagged_logging.rb:99:in `block in tagged'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/tagged_logging.rb:37:in `tagged'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/tagged_logging.rb:99:in `tagged'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activejob-6.1.6/lib/active_job/logging.rb:22:in `tag_logger'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activejob-6.1.6/lib/active_job/logging.rb:15:in `block (2 levels) in <module:Logging>'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:126:in `instance_exec'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/callbacks.rb:137:in `run_callbacks'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activejob-6.1.6/lib/active_job/execution.rb:47:in `perform_now'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activejob-6.1.6/lib/active_job/execution.rb:18:in `perform_now'
(irb):1:in `irb_binding'
/Users/marcbeaupre/.rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/irb/workspace.rb:114:in `eval'
/Users/marcbeaupre/.rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/irb/workspace.rb:114:in `evaluate'
/Users/marcbeaupre/.rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/irb/context.rb:459:in `evaluate'
/Users/marcbeaupre/.rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/irb.rb:541:in `block (2 levels) in eval_input'
/Users/marcbeaupre/.rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/irb.rb:704:in `signal_status'
/Users/marcbeaupre/.rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/irb.rb:538:in `block in eval_input'
/Users/marcbeaupre/.rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/irb/ruby-lex.rb:166:in `block (2 levels) in each_top_level_statement'
/Users/marcbeaupre/.rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/irb/ruby-lex.rb:151:in `loop'
/Users/marcbeaupre/.rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/irb/ruby-lex.rb:151:in `block in each_top_level_statement'
/Users/marcbeaupre/.rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/irb/ruby-lex.rb:150:in `catch'
/Users/marcbeaupre/.rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/irb/ruby-lex.rb:150:in `each_top_level_statement'
/Users/marcbeaupre/.rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/irb.rb:537:in `eval_input'
/Users/marcbeaupre/.rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/irb.rb:472:in `block in run'
/Users/marcbeaupre/.rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/irb.rb:471:in `catch'
/Users/marcbeaupre/.rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/irb.rb:471:in `run'
/Users/marcbeaupre/.rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/irb.rb:400:in `start'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/railties-6.1.6/lib/rails/commands/console/console_command.rb:70:in `start'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/railties-6.1.6/lib/rails/commands/console/console_command.rb:19:in `start'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/railties-6.1.6/lib/rails/commands/console/console_command.rb:102:in `perform'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/railties-6.1.6/lib/rails/command/base.rb:69:in `perform'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/railties-6.1.6/lib/rails/command.rb:48:in `invoke'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/railties-6.1.6/lib/rails/commands.rb:18:in `<main>'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:35:in `require'
/Users/marcbeaupre/workspace/Horse/bin/rails:9:in `<main>'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:39:in `load'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:39:in `load'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/fork_tracker.rb:10:in `block in fork'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/fork_tracker.rb:8:in `fork'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/fork_tracker.rb:8:in `fork'
/Users/marcbeaupre/.rvm/gems/ruby-2.7.6/gems/activesupport-6.1.6/lib/active_support/fork_tracker.rb:27:in `fork'
/Users/marcbeaupre/.rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
/Users/marcbeaupre/.rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
-e:1:in `<main>'
Traceback (most recent call last):
        1: from (irb):1
NoMethodError (undefined method `find' for #<String:0x00000001198ffa60>)
@alexisbernard
Copy link
Member

alexisbernard commented Jul 7, 2022

Thanks for the report. This error is a mistery for me, since Exception#backtrace_locations is supposed to return an array. I need to understand why the original backtrace is a string.

Could you provide me the type of the original exception please ? Is it possible that the method backtrace_locations of the original exception has been overridden ?

@hrdwdmrbl
Copy link
Author

I honestly wish I knew what the original exception was! I throw a lot of ActiveResource::ClientError and ActiveResource::ServerError, but that's just a statistic. I was also doing work on my local machine and was connected to my production DB and that connection is always flaky, so I get a lot of ActiveRecord connection errors. But those are just guesses.

I did try to get a breakpoint into your code to debug it but wasn't successful. I did see that that method sometimes returns nil also. Seems like a truly buggy method! :(

@alexisbernard
Copy link
Member

I have added a fallback to the old way in this case and some logging. Can you try to reproduce with the following version in your Gemfile please ?

gem "rorvswild", git: "https://github.com/BaseSecrete/rorvswild.git", ref: "42b66153ad0db9d7ab849e073604cec660f4d191"

If the error happens again, something should be printed by the following command grep -A 20 'Exception#backtrace_locations' log/development.log.

@hrdwdmrbl
Copy link
Author

Alright. I'm a bit apprehensive about running special versions of the code but for a little while I'll try it. I was able to reproduce the error twice in a row but then it stopped happening...

@alexisbernard
Copy link
Member

Do you have more details about the origin exception where backtrace_locations returns a string ?

@hrdwdmrbl
Copy link
Author

@alexisbernard I do not and I do not know if I ever will again. If and when I do, I will surely let you know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants