Stack level too deep
itsderek23 opened this issue · comments
After installing v5.2.0 (first install) in a Rails 6.1.5 app, I'm seeing errors like the following:
/app/vendor/bundle/ruby/3.1.0/gems/scout_apm-5.2.0/lib/scout_apm/config.rb:233:in `each': stack level too deep (SystemStackError)
I'm running on Heroku (I don't have a config file).
See similar issues in the scout_apm log:
[08/03/22 14:36:54 -0600 Dereks-MacBook-Pro.local (56345)] INFO : Exception sending request to server:
stack level too deep
/Users/dlite/.rvm/gems/ruby-3.1.2/gems/scout_apm-5.2.0/lib/scout_apm/config.rb:233:in `detect'
/Users/dlite/.rvm/gems/ruby-3.1.2/gems/scout_apm-5.2.0/lib/scout_apm/config.rb:233:in `overlay_for_key'
/Users/dlite/.rvm/gems/ruby-3.1.2/gems/scout_apm-5.2.0/lib/scout_apm/config.rb:241:in `value'
Same errors for me locally when I just a plain config file as well.
My apps's Gemfile.lock:
GEM
remote: https://rubygems.org/
specs:
actioncable (6.1.5)
actionpack (= 6.1.5)
activesupport (= 6.1.5)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.5)
actionpack (= 6.1.5)
activejob (= 6.1.5)
activerecord (= 6.1.5)
activestorage (= 6.1.5)
activesupport (= 6.1.5)
mail (>= 2.7.1)
actionmailer (6.1.5)
actionpack (= 6.1.5)
actionview (= 6.1.5)
activejob (= 6.1.5)
activesupport (= 6.1.5)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.1.5)
actionview (= 6.1.5)
activesupport (= 6.1.5)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.5)
actionpack (= 6.1.5)
activerecord (= 6.1.5)
activestorage (= 6.1.5)
activesupport (= 6.1.5)
nokogiri (>= 1.8.5)
actionview (6.1.5)
activesupport (= 6.1.5)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.5)
activesupport (= 6.1.5)
globalid (>= 0.3.6)
activemodel (6.1.5)
activesupport (= 6.1.5)
activerecord (6.1.5)
activemodel (= 6.1.5)
activesupport (= 6.1.5)
activestorage (6.1.5)
actionpack (= 6.1.5)
activejob (= 6.1.5)
activerecord (= 6.1.5)
activesupport (= 6.1.5)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (6.1.5)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
ast (2.4.2)
babel-source (5.8.35)
babel-transpiler (0.7.0)
babel-source (>= 4.0, < 6)
execjs (~> 2.0)
bcrypt (3.1.17)
bindex (0.8.1)
bootsnap (1.11.1)
msgpack (~> 1.2)
builder (3.2.4)
byebug (11.1.3)
concurrent-ruby (1.1.10)
connection_pool (2.2.5)
crass (1.0.6)
digest (3.1.0)
dotenv (2.7.6)
dotenv-rails (2.7.6)
dotenv (= 2.7.6)
railties (>= 3.2)
erubi (1.10.0)
execjs (2.8.1)
faraday (2.2.0)
faraday-net_http (~> 2.0)
ruby2_keywords (>= 0.0.4)
faraday-net_http (2.0.1)
ffi (1.15.5)
foreman (0.87.2)
geocoder (1.8.0)
globalid (1.0.0)
activesupport (>= 5.0)
heroicon (0.4.0)
rails (>= 5.2)
i18n (1.10.0)
concurrent-ruby (~> 1.0)
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
jwt (2.3.0)
kaminari (1.2.2)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.2)
kaminari-activerecord (= 1.2.2)
kaminari-core (= 1.2.2)
kaminari-actionview (1.2.2)
actionview
kaminari-core (= 1.2.2)
kaminari-activerecord (1.2.2)
activerecord
kaminari-core (= 1.2.2)
kaminari-core (1.2.2)
listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.15.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (1.0.2)
method_source (1.0.0)
mini_mime (1.1.2)
minitest (5.15.0)
msgpack (1.4.5)
multi_json (1.15.0)
multi_xml (0.6.0)
net-imap (0.2.3)
digest
net-protocol
strscan
net-pop (0.1.1)
digest
net-protocol
timeout
net-protocol (0.1.3)
timeout
net-smtp (0.3.1)
digest
net-protocol
timeout
nio4r (2.5.8)
nokogiri (1.13.3-arm64-darwin)
racc (~> 1.4)
nokogiri (1.13.3-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.13.3-x86_64-linux)
racc (~> 1.4)
oauth (0.5.8)
oauth2 (1.4.9)
faraday (>= 0.17.3, < 3.0)
jwt (>= 1.0, < 3.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
parallel (1.22.0)
parser (3.1.1.0)
ast (~> 2.4.1)
pg (1.3.4)
puma (5.6.2)
nio4r (~> 2.0)
racc (1.6.0)
rack (2.2.3)
rack-cors (1.1.1)
rack (>= 2.0.0)
rack-proxy (0.7.2)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.1.5)
actioncable (= 6.1.5)
actionmailbox (= 6.1.5)
actionmailer (= 6.1.5)
actionpack (= 6.1.5)
actiontext (= 6.1.5)
actionview (= 6.1.5)
activejob (= 6.1.5)
activemodel (= 6.1.5)
activerecord (= 6.1.5)
activestorage (= 6.1.5)
activesupport (= 6.1.5)
bundler (>= 1.15.0)
railties (= 6.1.5)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.2)
loofah (~> 2.3)
railties (6.1.5)
actionpack (= 6.1.5)
activesupport (= 6.1.5)
method_source
rake (>= 12.2)
thor (~> 1.0)
rainbow (3.1.1)
rake (13.0.6)
rb-fsevent (0.11.1)
rb-inotify (0.10.1)
ffi (~> 1.0)
react-rails (2.6.1)
babel-transpiler (>= 0.7.0)
connection_pool
execjs
railties (>= 3.2)
tilt
regexp_parser (2.2.1)
rexml (3.2.5)
rubocop (1.26.1)
parallel (~> 1.10)
parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.16.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.16.0)
parser (>= 3.1.1.0)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.5)
sass-rails (6.0.0)
sassc-rails (~> 2.1, >= 2.1.1)
sassc (2.4.0)
ffi (~> 1.9)
sassc-rails (2.1.2)
railties (>= 4.0.0)
sassc (>= 2.0)
sprockets (> 3.0)
sprockets-rails
tilt
scout_apm (5.2.0)
parser
semantic_range (3.0.0)
sentry-rails (5.3.1)
railties (>= 5.0)
sentry-ruby-core (~> 5.3.1)
sentry-ruby (5.3.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
sentry-ruby-core (= 5.3.1)
sentry-ruby-core (5.3.1)
concurrent-ruby
sorcery (0.16.3)
bcrypt (~> 3.1)
oauth (~> 0.5, >= 0.5.5)
oauth2 (~> 1.0, >= 0.8.0)
spring (4.0.0)
sprockets (4.0.3)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.4.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
stripe (5.45.0)
strscan (3.0.3)
tailwindcss-rails (2.0.8-arm64-darwin)
railties (>= 6.0.0)
tailwindcss-rails (2.0.8-x86_64-darwin)
railties (>= 6.0.0)
tailwindcss-rails (2.0.8-x86_64-linux)
railties (>= 6.0.0)
thor (1.2.1)
tilt (2.0.10)
timeout (0.3.0)
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
unicode-display_width (2.1.0)
web-console (4.2.0)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webpacker (5.4.3)
activesupport (>= 5.2)
rack-proxy (>= 0.6.1)
railties (>= 5.2)
semantic_range (>= 2.3.0)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.5.4)
PLATFORMS
arm64-darwin-21
x86_64-darwin-18
x86_64-darwin-19
x86_64-darwin-21
x86_64-linux
DEPENDENCIES
bootsnap (>= 1.4.4)
byebug
dotenv-rails (~> 2.1, >= 2.1.1)
foreman
geocoder
heroicon
jbuilder (~> 2.7)
kaminari (~> 1.2.2)
listen (~> 3.3)
net-imap
net-pop
net-smtp
pg (~> 1.3)
puma (~> 5.6)
rack-cors (~> 1.1.1)
rails (~> 6.1.5, >= 6.1.4.7)
react-rails (~> 2.6, >= 2.6.1)
rubocop (~> 1.26, >= 1.26.1)
sass-rails (>= 6)
scout_apm
sentry-rails
sentry-ruby
sorcery (~> 0.16.3)
spring
stripe (~> 5.45)
tailwindcss-rails (~> 2.0, >= 2.0.8)
turbolinks (~> 5)
tzinfo-data
web-console (>= 4.1.0)
webpacker (~> 5.4)
RUBY VERSION
ruby 3.1.2p20
BUNDLED WITH
2.3.9
We've seen stack level too deep with conflicting instrumentation methods, but not usually within config.rb. Can you also post your Gemfile
and I'll see if I can reproduce. Which heroku env vars starting with SCOUT_
do you have set?
Hey @dlanderson!
Gemfile below (scout_apm is commented out).
I don't think it's Heroku or env-related anymore (seeing the same locally).
I haven't had a chance to test this yet, but I wonder if it is related to Sentry. I forgot they have perf monitoring now and is enabled by default.
# frozen_string_literal: true
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '3.1.2'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem 'rails', '~> 6.1.5', '>= 6.1.4.7'
# Use postgresql as the database for Active Record
gem 'pg', '~> 1.3'
# Use Puma as the app server
gem 'puma', '~> 5.6'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 5.4'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# SMPT [now needed in Ruby3/Rails6](https://stackoverflow.com/questions/71851775/rails-6-1-5-uninitialized-constant-mailtestmailer)
gem 'net-smtp' # to send email
gem 'net-imap' # for rspec
gem 'net-pop' # for rspec
# Use Active Storage variant
# gem 'image_processing', '~> 1.2'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.4', require: false
gem 'rack-cors', '~> 1.1.1'
# https://github.com/reactjs/react-rails
gem 'react-rails', '~> 2.6', '>= 2.6.1'
# Auth
gem 'sorcery', '~> 0.16.3'
# Pagination
gem 'kaminari', '~> 1.2.2'
# Payments
gem 'stripe', '~> 5.45'
# Exception Monitoring
gem "sentry-ruby"
gem "sentry-rails"
# ip address to location
gem "geocoder"
# APM
# gem 'scout_apm'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: %i[mri mingw x64_mingw]
# Autoload dotenv in Rails
gem 'dotenv-rails', '~> 2.1', '>= 2.1.1'
end
group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 4.1.0'
# Display performance information such as SQL time and flame graphs for each request in your browser.
# Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
gem 'listen', '~> 3.3'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
# Ruby code style checking and code formatting tool
gem 'rubocop', '~> 1.26', '>= 1.26.1'
# Simplier app startup
gem 'foreman'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
gem 'tailwindcss-rails', '~> 2.0', '>= 2.0.8'
# Heroicons (via Tailwind)
gem "heroicon"
It probably is related to Sentry. We don't usually see it manifest in config.rb
as the top level in backtrace, though. Try switching the order of the sentry and scout_apm gems so scout_apm is listed before any sentry gem:
# ip address to location
gem "geocoder"
# APM
# gem 'scout_apm'
# Exception Monitoring
gem "sentry-ruby"
gem "sentry-rails"
I'm working to release #448 which gives the option of using either alias_method
or prepend
for most of the instruments. #448
Adjusting the load order doesn't seem to help, but commenting out Sentry does get things working for Scout. So, that leads me to believe it is an issue w/Sentry.
Thanks @itsderek23 - This should be resolved by #448 which I will release as a new Gem version Monday.