Skip to content

Commit 1671951

Browse files
authored
Fix jetty context leak (#1966)
1 parent d9dc07c commit 1671951

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

javaagent-api/src/main/java/io/opentelemetry/javaagent/instrumentation/api/concurrent/ExecutorInstrumentationUtils.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ public static boolean shouldAttachStateToTask(Object task) {
3434
// TODO Workaround for
3535
// https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/787
3636
&& !taskClass.getName().equals("org.apache.tomcat.util.net.NioEndpoint$SocketProcessor")
37-
// Don't instrument the executor's own runnables. These runnables may never return until
37+
// Avoid context leak on jetty. Runnable submitted from SelectChannelEndPoint is used to
38+
// process a new request which should not have context from them current request.
39+
&& (enclosingClass == null
40+
|| !enclosingClass.getName().equals("org.eclipse.jetty.io.nio.SelectChannelEndPoint"))
41+
// Don't instrument the executor's own runnables. These runnables may never return until
3842
// netty shuts down.
3943
&& (enclosingClass == null
4044
|| !enclosingClass

0 commit comments

Comments
 (0)