Dd-trace-rb: Failed to deploy after 0.35.0 upgrade

Created on 5 May 2020  路  8Comments  路  Source: DataDog/dd-trace-rb

We upgraded to 0.35.0 and our deploy release step (bundle exec rails db:migrate) on Heroku failed with the following error message:

/app/vendor/bundle/ruby/2.6.0/gems/ddtrace-0.35.0/lib/ddtrace/configuration/components.rb:150:in `each': undefined method `close' for nil:NilClass (NoMethodError)
    from /app/vendor/bundle/ruby/2.6.0/gems/ddtrace-0.35.0/lib/ddtrace/configuration/components.rb:150:in `teardown!'
    from /app/vendor/bundle/ruby/2.6.0/gems/ddtrace-0.35.0/lib/ddtrace/configuration.rb:44:in `shutdown!'
    from /app/vendor/bundle/ruby/2.6.0/gems/ddtrace-0.35.0/lib/ddtrace.rb:37:in `block in <module:Datadog>'

Reverting to 0.34.2 makes the command succeed without any other changes.

We're running Rails 6.0.2.2 and Ruby 2.6.5 if that helps. If you need any more information just let me know and I'll try to respond as fast as I can :smile:

bug community core

Most helpful comment

@marcotc I just updated the gem and deployed it, and it's working fine!
Thanks for the quick help solving this :smile: :+1:

All 8 comments

I think this Array wasn't compacted as it should have been, leading to the error you're seeing.

https://github.com/DataDog/dd-trace-rb/blob/10592cebfed7d4f9c509910e4d11faaf00cca668/lib/ddtrace/configuration/components.rb#L135

I think we have the same issue over on this one: https://github.com/artsy/convection/pull/617. Feel free to use convection as a test case since it's open source! A good way to reproduce this is to run this one:

$ bundle exec rake environment

That'll load the Rails environment and get you a stacktrace:

Traceback (most recent call last):
        3: from /Users/jon/.asdf/installs/ruby/2.7.0/lib/ruby/gems/2.7.0/gems/ddtrace-0.35.0/lib/ddtrace.rb:37:in `block in <module:Datadog>'
        2: from /Users/jon/.asdf/installs/ruby/2.7.0/lib/ruby/gems/2.7.0/gems/ddtrace-0.35.0/lib/ddtrace/configuration.rb:44:in `shutdown!'
        1: from /Users/jon/.asdf/installs/ruby/2.7.0/lib/ruby/gems/2.7.0/gems/ddtrace-0.35.0/lib/ddtrace/configuration/components.rb:150:in `teardown!'
/Users/jon/.asdf/installs/ruby/2.7.0/lib/ruby/gems/2.7.0/gems/ddtrace-0.35.0/lib/ddtrace/configuration/components.rb:150:in `each': undefined method `close' for nil:NilClass (NoMethodError)

Hope that helps! 鉂わ笍

Opened a PR here: https://github.com/DataDog/dd-trace-rb/pull/1023

Could you try it out @bzf and confirm it fixes your issue?

@delner Yes, it worked when deploying with that branch! :+1:

A good way to reproduce this is to run this one:

$ bundle exec rake environment

FWIW I did try your application and datadog.rb configuration with bundle exec rake environment but was unable to reproduce the bug.

Although I think we pinned the bug itself in that PR, it's unclear to me what in user configuration is causing the Statsd instance to be nil... we haven't been able to replicate this in any of our test environments or sample apps.

Okay cool, we'll get a bugfix shipped ASAP. Thanks for the report @bzf!

Thank you again for this report @bzf @jonallured!
We've just released 0.35.1, with the fix: https://github.com/DataDog/dd-trace-rb/pull/1023.

Given it's the same code as the branch you've tried @bzf, I don't think this issue will persist, but please let us know otherwise.

@marcotc I just updated the gem and deployed it, and it's working fine!
Thanks for the quick help solving this :smile: :+1:

Was this page helpful?
0 / 5 - 0 ratings