Skip to content

Commit 7e187f7

Browse files
authored
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.
1 parent fad7b24 commit 7e187f7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/ignore/GlobalIgnoredTypesConfigurer.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ private static void configureIgnoredTypes(IgnoredTypesBuilder builder) {
110110

111111
private static void configureIgnoredClassLoaders(IgnoredTypesBuilder builder) {
112112
builder
113+
.ignoreClassLoader("groovy.lang.GroovyClassLoader")
113114
.ignoreClassLoader("org.codehaus.groovy.runtime.callsite.CallSiteClassLoader")
115+
.ignoreClassLoader("org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyClassLoader")
114116
.ignoreClassLoader("sun.reflect.DelegatingClassLoader")
115117
.ignoreClassLoader("jdk.internal.reflect.DelegatingClassLoader")
116118
.ignoreClassLoader("clojure.lang.DynamicClassLoader")

0 commit comments

Comments
 (0)