Add additional groovy classloaders to ignore list. (#7460)

Groovy apps that parse a lot of scripts can generate a lot of
classloaders that will ultimately end up causing the agent to cache a
LOT of memory. For example, some java code that uses the Gremlin groovy
script engine to dynamically create and execute scripts can reproduce
this:

```
    GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine();
    Bindings bindings = new SimpleBindings();
    TinkerGraph graph = TinkerGraph.open();
    GraphTraversalSource g = graph.traversal();
    bindings.put("g", g);
    for (int i = 0; i < 100000; i++) {
      engine.eval("g.V(" + i + ")", bindings);
      if(i % 250 == 0) System.out.println("Iteration " + i);
    }
```

I have manually confirmed that ignoring the groovy classloaders (in this
PR) prevent the agent from exploding the cache and holding onto memory.
I could use another brain in deciding if there could be other unintended
consequences.
This commit is contained in:
jason plumb 2023-02-23 09:39:54 -08:00 committed by GitHub
parent fad7b24253
commit 7e187f78e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -110,7 +110,9 @@ public class GlobalIgnoredTypesConfigurer implements IgnoredTypesConfigurer {
private static void configureIgnoredClassLoaders(IgnoredTypesBuilder builder) { private static void configureIgnoredClassLoaders(IgnoredTypesBuilder builder) {
builder builder
.ignoreClassLoader("groovy.lang.GroovyClassLoader")
.ignoreClassLoader("org.codehaus.groovy.runtime.callsite.CallSiteClassLoader") .ignoreClassLoader("org.codehaus.groovy.runtime.callsite.CallSiteClassLoader")
.ignoreClassLoader("org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyClassLoader")
.ignoreClassLoader("sun.reflect.DelegatingClassLoader") .ignoreClassLoader("sun.reflect.DelegatingClassLoader")
.ignoreClassLoader("jdk.internal.reflect.DelegatingClassLoader") .ignoreClassLoader("jdk.internal.reflect.DelegatingClassLoader")
.ignoreClassLoader("clojure.lang.DynamicClassLoader") .ignoreClassLoader("clojure.lang.DynamicClassLoader")