Comments (7)
Are you running DJ with something like script/rails delayed_job start
? If so this is probably caused by a compatibility issue with the Daemons gem that DJ uses under the hood we're currently in the process of debugging and fixing.
There's some more information here: thuehlinger/daemons#47
from appsignal-ruby.
Hi @thijsc,
in production I start DJ from capistrano using this gem which calls
bundle exec script/delayed_job -n 1 --pool=.... --pool=.... restart
in development I start DJ with the rake task jobs:work
The problem occurred only once in production, but is consistent in development.
from appsignal-ruby.
Hi @thijsc ,
I got more information about the problem, specifically, I found out why it happens in development and not in production.
I had an error in my Gemfile:
group :development, :test do
gem 'factory_girl_rails'
gem 'rspec'
gem 'rspec-rails'
gem 'rspec-collection_matchers'
gem 'shoulda-matchers'
gem 'database_cleaner'
gem 'timecop'
gem 'sunspot-rails-tester
gem 'capybara'
gem 'launchy'
gem 'capybara-screenshot'
gem 'capybara-webkit'
end
Probably because of a copy-paste, I was requiring spec gems in development.
This resulted in Appsignal::Transaction::GenericRequest to have its ancestors chain become
[
"Appsignal::Transaction::GenericRequest",
"Object",
"ActionDispatch::TestProcess",
"Delayed::MessageSending",
"ActiveSupport::Dependencies::Loadable",
"FriendlyId::ObjectUtils",
"JSON::Ext::Generator::GeneratorMethods::Object",
"PP::ObjectMixin",
"Kernel",
"BasicObject"
]
instead of this:
[
"Appsignal::Transaction",
"Object",
"Delayed::MessageSending",
"ActiveSupport::Dependencies::Loadable",
"FriendlyId::ObjectUtils",
"JSON::Ext::Generator::GeneratorMethods::Object",
"PP::ObjectMixin",
"Kernel",
"BasicObject"
]
This led Appsignal's code to expect GenericRequest to have a session, which resulted in an infinite loop (for some reason I cannot fathom).
While running specs, Appsignal is not meant to be active.
I'm monitoring my dev environment for a bunch of reasons, but most people won't face this issue at all.
From my point of view this issue is closed.
In case people make my same mistake, this could save quite a headache cause for me it was hard to track down.
For those facing the same issue, keep in mind to stop spring between trials!
Cheers and kudos for your awesome work!
from appsignal-ruby.
I will take a look at that infinite loop. That shouldn't be possible, even in weird circumstances. Leaving this issue open for that.
Thanks for this great debugging session!
from appsignal-ruby.
I see, glad it helps you guys too :)
from appsignal-ruby.
I've had trouble reproducing this. I think it might be relevant only in this specific scenario when using Spring. Closing this issue.
from appsignal-ruby.
Just ran into the same underlying issue (Stack level too deep
related to request.session
), but not related to DJ.
Environment
- Rails 5.2
- Ruby 2.3
- Appsignal 2.10.7
Reproduction steps
- In
appsignal.yml
: set Appsignalactive: true
in the test environment, and ensureskip_session_data
istrue
(this is the default, so if it isn't defined in your config that should work) - Add
include ActionDispatch::TestProcess
globally in specs (e.g. viarails_helper
) -- we had this in place to makefixture_file_upload
available to use in factories - If you don't have one, write a test to ensure Appsignal works. For us, we had a class reporting a handled error (via
Appsignal.send_error
), and we had a spec for that code to ensure the errors got sent to Appsignal. E.g. for RSpec:expect(Appsignal).to receive(:send_error).with(StandardError)
- Run the spec, see
Stack level too deep
errors (withlib/action_dispatch/testing/test_process.rb
in the stack trace)
How we fixed it
- Some Googling (query:
actionpack request session test stacklevel
) brought me to this SO post, which indicates a similar problem, the underlying cause being the use ofinclude ActionDispatch::TestProcess
- A link from that SO post goes here activeadmin/activeadmin#512, which has this comment indicating a similar thing
- With this info, removed our
include ActionDispatch::TestProcess
inrails_helper.rb
and replaced our use offixture_file_upload
in factories to useRack::Test::UploadedFile.new
This doesn't feel like an Appsignal-specific issue, but I wanted to post here for future reference.
from appsignal-ruby.
Related Issues (20)
- Fix Sidekiq 7.1 error handler deprecation HOT 1
- Add support for SolidCache HOT 2
- Add support for Solid Queue HOT 8
- Sidekiq minutely probe reports error
- Support nested exceptions HOT 12
- Allow to build custom_data sample data HOT 2
- Use thread-local variables instead of fiber-local variables to store global configuration HOT 1
- Extension fails to load under Alpine Linux 3.19 HOT 1
- Diagnose report fails to send `mkmf.log`
- Appsignal logger causes sidekiq to crash HOT 2
- Log not being rotated HOT 5
- Rename internal logger
- The request header REQUEST_URI contains PII or secrets that should be stripped via filter_parameters HOT 4
- Typo in Changelog HOT 1
- Report activejob errors only when the job is discarded HOT 2
- Rails.error.report is missing information compared to Appsignal.set_error HOT 9
- Cron heartbeats support HOT 3
- AppSignal Agent crashes and stops logging: No longer owner of lock file '/tmp/appsignal/agent.lock', agent exiting HOT 2
- Allow sending custom_data via the Rails error reporter
- Error in STDOUT about unable to log sql events HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from appsignal-ruby.