Open
Description
The Spring::Application#shush_backtraces
method strips out Spring stackframes from the exception's backtrace
, but not its backtrace_locations
:
spring/lib/spring/application.rb
Line 322 in 046d50a
This causes at least 2 issues:
- The
backtrace
andbacktrace_locations
become out of sync, and only when running in Spring. - It breaks the downstream behaviour of
ActiveSupport::ErrorReporter
, whose#report
method will clean itself off the top of the stack. Since the top of the stack will be these 2 Spring frames, its logic won't remove any of the frames.
Example
#!/opt/rubies/3.4.2/bin/ruby
begin
raise
rescue => e
end
puts "\nbacktrace:"
puts e.backtrace.first(2)
puts "\nbacktrace_locations:"
puts e.backtrace_locations.first(4)
Output (truncated):
$ bundle exec rails runner demo.rb
Running via Spring preloader in process 33573
running spring after_fork
backtrace
.../demo.rb:4:in '<main>'
.../gems/rails-8b00d0985f88/railties/lib/rails/commands/runner/runner_command.rb:44:in 'Kernel.load'
backtrace_locations
.../gems/spring-4.2.1/lib/spring/application.rb:313:in 'Method#call'
.../gems/spring-4.2.1/lib/spring/application.rb:313:in 'block (2 levels) in Kernel#shush_backtraces'
.../demo.rb:4:in '<main>'
.../gems/rails-8b00d0985f88/railties/lib/rails/commands/runner/runner_command.rb:44:in 'Kernel.load'
Metadata
Metadata
Assignees
Labels
No labels