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

[PROF-10967] Fix profiler not loading due to "rb_obj_info" symbol not found #4161

Merged
merged 3 commits into from
Nov 26, 2024

Commits on Nov 26, 2024

  1. [PROF-10967] Fix profiler not loading due to "rb_obj_info" symbol not…

    … found
    
    **What does this PR do?**
    
    This PR fixes a bug introduced in #4020, specifically in f581076 .
    
    We started using the `rb_obj_info` to print debug information about
    objects in some cases, BUT I failed to notice that this API is not
    really available on Ruby 2.5 and 3.3 (but is on all others, which
    is why it tripped me).
    
    This manifested in the following error reported by a customer:
    
    > WARN -- datadog: [datadog] Profiling was requested but is not
    > supported, profiling disabled: There was an error loading the
    > profiling native extension due to 'RuntimeError Failure to load
    > datadog_profiling_native_extension.3.3.5_x86_64-linux-musl due
    > to Error relocating
    > /app/vendor/bundle/ruby/3.3.0/gems/datadog-2.6.0/lib/datadog/profiling/../../datadog_profiling_native_extension.3.3.5_x86_64-linux-musl.so:
    > rb_obj_info: symbol not found' at
    > '/app/vendor/bundle/ruby/3.3.0/gems/datadog-2.6.0/lib/datadog/profiling/load_native_extension.rb:41:in `<main>''
    
    This PR fixes this issue by never referencing `rb_obj_info` on
    those Rubies. Since this API is only used for printing information
    during errors, this should be fine (and is better than the alternative
    of not printing info on any Rubies).
    
    **Motivation:**
    
    Fix profiling not loading in certain situations on Ruby 2.5 and 3.3.
    
    **Additional Notes:**
    
    Interestingly, this issue did not show up on glibc systems. I guess
    musl libc is being a bit more eager about trying to resolve symbols?
    
    **How to test the change?**
    
    This change includes test coverage. Disabling the added check
    in `extconf.rb` will produce a failing test.
    ivoanjo committed Nov 26, 2024
    Configuration menu
    Copy the full SHA
    a257c35 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6518e65 View commit details
    Browse the repository at this point in the history
  3. Bump test-memcheck job to use 3.4.0-preview2

    The `rb_obj_info` got re-exposed later in the 3.4 development cycle,
    so our test that was still running with 3.4.0-preview1 was failing
    because it still had not been changed.
    ivoanjo committed Nov 26, 2024
    Configuration menu
    Copy the full SHA
    94104b8 View commit details
    Browse the repository at this point in the history