Skip to content

Conversation

@felixbarny
Copy link
Member

@felixbarny felixbarny commented Oct 27, 2020

What does this PR do?

Fixes #1450

Checklist

  • This is a bugfix

I've tried creating a test for this (see 9dcaff3) but gave up.

The problem is that the instrumented class will be defined by the system class loader which is also a parent of the IndyPluginClassLoader as it’s the agent class loader in unit tests. Thus, the IndyPluginClassLoader will load the instrumented class from the system class loader before trying to load from the custom class loader. That’s because we want to give precedence to load classes in the agent class loader.
This results in a linkage error as the class resolved by the IndyPluginClassLoader is not the same as the one from the custom class loader whose parent is the bootstrap class loader.
The test also requires that the signature of the advice contains a class that's defined in two different class loader hierarchies. But that class must not be within the package co.elastic.apm.* as these are not available in production in the context of the instrumented methods.

@felixbarny felixbarny requested a review from eyalkoren October 27, 2020 13:40
@ghost
Copy link

ghost commented Oct 27, 2020

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #1458 updated]

  • Start Time: 2020-10-27T14:10:02.275+0000

  • Duration: 45 min 15 sec

Test stats 🧪

Test Results
Failed 0
Passed 1615
Skipped 12
Total 1627

Copy link
Contributor

@eyalkoren eyalkoren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Elegant!
Only comment is to try and make sure the new LookupExposer is only loaded once within each class loading hierarchy, for good measures 🙂

Co-authored-by: eyalkoren <41850454+eyalkoren@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants