Instrumenting both Redis and Sidekiq leads to "stack level too deep (SystemStackError)"
Leee-xx opened this issue · 1 comments
Current behaviour
I'm trying to upgrade ddtrace from 0.53.0 to 1.23.0 for one of our Rails apps that instruments both Sidekiq and Redis, which unfortunately, leads to a "stack level too deep" error, and the app fails to start up. I've seen another issue involving prometheus_explorer, which we do use, but we're on the latest available version (2.1.0), which I assume from the issue's thread should have resolved the problem.
Expected behaviour
The app should be able to start up.
Steps to reproduce
- Install ddtrace 1.23.0.
- Instrument both redis and sidekiq.
- Start the app in an environment where the DD agent is running.
The logs have been a little difficult to come by, and given the size of things, this is the best that I've been able to find:
/usr/local/bundle/gems/ddtrace-1.23.0/lib/datadog/tracing/span_operation.rb:107:in `name=': stack level too deep (SystemStackError)
from /usr/local/bundle/gems/ddtrace-1.23.0/lib/datadog/tracing/span_operation.rb:58:in `initialize'
from /usr/local/bundle/gems/ddtrace-1.23.0/lib/datadog/tracing/trace_operation.rb:236:in `new'
from /usr/local/bundle/gems/ddtrace-1.23.0/lib/datadog/tracing/trace_operation.rb:236:in `build_span'
from /usr/local/bundle/gems/ddtrace-1.23.0/lib/datadog/tracing/trace_operation.rb:186:in `measure'
from /usr/local/bundle/gems/ddtrace-1.23.0/lib/datadog/tracing/tracer.rb:385:in `start_span'
from /usr/local/bundle/gems/ddtrace-1.23.0/lib/datadog/tracing/tracer.rb:159:in `block in trace'
from /usr/local/bundle/gems/ddtrace-1.23.0/lib/datadog/tracing/context.rb:45:in `activate!'
from /usr/local/bundle/gems/ddtrace-1.23.0/lib/datadog/tracing/tracer.rb:158:in `trace'
... 7875 levels...
from /usr/local/bundle/gems/coverband-6.1.2/lib/coverband/collectors/coverage.rb:58:in `synchronize'
from /usr/local/bundle/gems/coverband-6.1.2/lib/coverband/collectors/coverage.rb:58:in `report_coverage'
from /usr/local/bundle/gems/coverband-6.1.2/lib/coverband.rb:69:in `report_coverage'
from /usr/local/bundle/gems/coverband-6.1.2/lib/coverband/at_exit.rb:22:in `block (2 levels) in register'
How does datadog
help you?
Environment
- datadog version: 1.23.0
- Configuration block (
Datadog.configure ...
):
Datadog.configure do |c|
...
c.tracing.instrument :sidekiq,
client_service_name: 'app-sidekiq-client',
service_name: 'app-sidekiq'
c.tracing.instrument :redis, service_name: 'app-redis'
end
- Ruby version: 3.1.4
- Operating system:
Debian GNU/Linux 11 (bullseye)
- Relevant library versions: prometheus_explorer 2.1.0
👋 @Leee-xx Have you taken a look at this?
https://github.com/danmayer/coverband?tab=readme-ov-file#solving-stack-level-too-deep-errors
It seems like other gems are causing this with alias_method
.
We've documented here: https://github.com/DataDog/dd-trace-rb/blob/master/docs/GettingStarted.md#stack-level-too-deep