diff --git a/instrumentation/httpurlconnection/src/main/java/com/nr/agent/instrumentation/httpurlconnection/InboundWrapper.java b/instrumentation/httpurlconnection/src/main/java/com/nr/agent/instrumentation/httpurlconnection/InboundWrapper.java index 750192be2c..6a9fe348ff 100644 --- a/instrumentation/httpurlconnection/src/main/java/com/nr/agent/instrumentation/httpurlconnection/InboundWrapper.java +++ b/instrumentation/httpurlconnection/src/main/java/com/nr/agent/instrumentation/httpurlconnection/InboundWrapper.java @@ -18,6 +18,9 @@ public class InboundWrapper extends ExtendedInboundHeaders { private final HttpURLConnection connection; public InboundWrapper(HttpURLConnection connection) { + // Do not try to optimize by holding a reference to the header map obtained from HttpURLConnection.getHeaderFields + // instead of holding a reference to the HttpURLConnection instance, as it will trigger a call to + // HttpURLConnection.getInputStream and infinitely loop through this instrumentation. this.connection = connection; }