Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin dogstatsd-ruby to v4 while we adapt the compatibility with the dogstatsd-ruby companion thread. #1533

Merged
merged 4 commits into from
May 31, 2021

Conversation

remeh
Copy link
Contributor

@remeh remeh commented May 31, 2021

Let's advise to pin to dogstatsd-ruby to v4.x until DataDog/dogstatsd-ruby#182 is fixed.

@remeh remeh added the docs Involves documentation label May 31, 2021
@remeh remeh requested a review from a team May 31, 2021 08:58
@remeh remeh force-pushed the remeh/dsd-ruby-4 branch from 1f4efd1 to 55fe73c Compare May 31, 2021 09:49
@marcotc marcotc merged commit b05fddf into master May 31, 2021
@marcotc marcotc deleted the remeh/dsd-ruby-4 branch May 31, 2021 17:32
@github-actions github-actions bot added this to the 0.50.0 milestone May 31, 2021
@marcotc marcotc restored the remeh/dsd-ruby-4 branch May 31, 2021 17:36
@marcotc marcotc deleted the remeh/dsd-ruby-4 branch May 31, 2021 17:37
marcotc added a commit that referenced this pull request May 31, 2021
@marcotc
Copy link
Member

marcotc commented May 31, 2021

Backported this change to our release branch, so our official documentation updates immediately, instead of waiting for the next release.

marcotc pushed a commit that referenced this pull request Jun 8, 2021
The `google-protobuf` gem depends on a native component, and its
creators helpfully tried to provide precompiled versions of this
extension on rubygems.org.

Unfortunately, for a long time, the supported Ruby versions metadata on
these precompiled versions of the extension was not correctly set.
(This is fixed in newer versions -- but not all Ruby versions we
want to support can use these.)

As an example, if you try to use version 3.6.1 (from 2018) with
Ruby 2.7 (released in December 2019) it'll happily install the
precompiled version of the gem:

```
$ gem install google-protobuf -v "3.6.1"
Fetching google-protobuf-3.6.1-universal-darwin.gem
Successfully installed google-protobuf-3.6.1-universal-darwin
Parsing documentation for google-protobuf-3.6.1-universal-darwin
Installing ri documentation for google-protobuf-3.6.1-universal-darwin
Done installing documentation for google-protobuf after 0 seconds
1 gem installed
```

and then proceed to fail loading when you try to use it:

```
$ ruby -e "require 'bundler/inline'; gemfile { gem 'google-protobuf', '= 3.6.1' }"
Traceback (most recent call last):
	7: from -e:1:in `<main>'
	6: from /Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/bundler-1.17.3/lib/bundler/inline.rb:70:in `gemfile'
	5: from /Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `require'
	4: from /Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `each'
	3: from /Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/bundler-1.17.3/lib/bundler/runtime.rb:76:in `block in require'
	2: from /Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/bundler-1.17.3/lib/bundler/runtime.rb:76:in `each'
	1: from /Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/bundler-1.17.3/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
/Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/bundler-1.17.3/lib/bundler/runtime.rb:81:in `require': cannot load such file -- google-protobuf (LoadError)
	8: from -e:1:in `<main>'
	7: from /Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/bundler-1.17.3/lib/bundler/inline.rb:70:in `gemfile'
	6: from /Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `require'
	5: from /Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `each'
	4: from /Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/bundler-1.17.3/lib/bundler/runtime.rb:72:in `block in require'
	3: from /Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/bundler-1.17.3/lib/bundler/runtime.rb:95:in `rescue in block in require'
	2: from /Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/bundler-1.17.3/lib/bundler/runtime.rb:95:in `require'
	1: from /Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/google-protobuf-3.6.1-universal-darwin/lib/google/protobuf.rb:48:in `<top (required)>'
/Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/google-protobuf-3.6.1-universal-darwin/lib/google/protobuf.rb:48:in `require': cannot load such file -- google/2.7/protobuf_c (LoadError)
	9: from -e:1:in `<main>'
	8: from /Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/bundler-1.17.3/lib/bundler/inline.rb:70:in `gemfile'
	7: from /Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `require'
	6: from /Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `each'
	5: from /Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/bundler-1.17.3/lib/bundler/runtime.rb:72:in `block in require'
	4: from /Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/bundler-1.17.3/lib/bundler/runtime.rb:95:in `rescue in block in require'
	3: from /Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/bundler-1.17.3/lib/bundler/runtime.rb:95:in `require'
	2: from /Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/google-protobuf-3.6.1-universal-darwin/lib/google/protobuf.rb:47:in `<top (required)>'
	1: from /Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/google-protobuf-3.6.1-universal-darwin/lib/google/protobuf.rb:50:in `rescue in <top (required)>'
/Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/google-protobuf-3.6.1-universal-darwin/lib/google/protobuf.rb:50:in `require': cannot load such file -- google/protobuf_c (LoadError)
```

Because we try to `require 'google/protobuf'` during gem
initialization, this meant that we could break existing customer
applications on environments with a broken protobuf gem.

This looked something like:

```
$ DD_TRACE_DEBUG=true DD_PROFILING_ENABLED=true be bin/ddtracerb exec ruby -e 'sleep'
/Users/ivo.anjo/.rvm/gems/ruby-3.0.0/gems/google-protobuf-3.6.1-universal-darwin/lib/google/protobuf.rb:48:in `require': cannot load such file -- google/3.0/protobuf_c (LoadError)
  from /Users/ivo.anjo/.rvm/gems/ruby-3.0.0/gems/google-protobuf-3.6.1-universal-darwin/lib/google/protobuf.rb:48:in `<top (required)>'
  from /Users/ivo.anjo/datadog/dd-trace-rb/lib/ddtrace/profiling/pprof/pprof_pb.rb:4:in `require'
  from /Users/ivo.anjo/datadog/dd-trace-rb/lib/ddtrace/profiling/pprof/pprof_pb.rb:4:in `<top (required)>'
  from /Users/ivo.anjo/datadog/dd-trace-rb/lib/ddtrace/profiling.rb:36:in `require'
  from /Users/ivo.anjo/datadog/dd-trace-rb/lib/ddtrace/profiling.rb:36:in `load_profiling'
  from /Users/ivo.anjo/datadog/dd-trace-rb/lib/ddtrace/profiling.rb:39:in `<module:Profiling>'
  from /Users/ivo.anjo/datadog/dd-trace-rb/lib/ddtrace/profiling.rb:3:in `<module:Datadog>'
  from /Users/ivo.anjo/datadog/dd-trace-rb/lib/ddtrace/profiling.rb:1:in `<top (required)>'
  from /Users/ivo.anjo/datadog/dd-trace-rb/lib/ddtrace/configuration/components.rb:3:in `require'
  from /Users/ivo.anjo/datadog/dd-trace-rb/lib/ddtrace/configuration/components.rb:3:in `<top (required)>'
  from /Users/ivo.anjo/datadog/dd-trace-rb/lib/ddtrace/configuration.rb:4:in `require'
  from /Users/ivo.anjo/datadog/dd-trace-rb/lib/ddtrace/configuration.rb:4:in `<top (required)>'
  from /Users/ivo.anjo/datadog/dd-trace-rb/lib/ddtrace.rb:14:in `require'
  from /Users/ivo.anjo/datadog/dd-trace-rb/lib/ddtrace.rb:14:in `<top (required)>'
  from /Users/ivo.anjo/datadog/dd-trace-rb/lib/ddtrace/profiling/preload.rb:1:in `require'
  from /Users/ivo.anjo/datadog/dd-trace-rb/lib/ddtrace/profiling/preload.rb:1:in `<top (required)>'
  from -e:in `require'
```

Instead, let's gracefully handle the failure and disable profiling:

```
$ DD_TRACE_DEBUG=true DD_PROFILING_ENABLED=true be bin/ddtracerb exec ruby -e 'sleep'
[DDTRACE] Error while loading google-protobuf gem. Cause: 'cannot load such file -- google/protobuf_c' Location: '/Users/ivo.anjo/.rvm/gems/ruby-2.7.2/gems/google-protobuf-3.6.1-universal-darwin/lib/google/protobuf.rb:50:in `require''. This can happen when google-protobuf is missing its native components. To fix this, try removing and reinstalling the gem, forcing it to recompile the components: `gem uninstall google-protobuf -a; BUNDLE_FORCE_RUBY_PLATFORM=true bundle install`. If the error persists, please contact support via <https://docs.datadoghq.com/help/> or file a bug at <https://github.com/DataDog/dd-trace-rb/blob/master/CONTRIBUTING.md#found-a-bug>.
W, [2021-03-22T11:13:09.129446 #1533]  WARN -- ddtrace: [ddtrace] (/Users/ivo.anjo/datadog/dd-trace-rb/lib/ddtrace/configuration/components.rb:184:in `startup!') Profiling was enabled but is not supported; profiling disabled. (google-protobuf?: false)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Involves documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants