From 9d2e350b042fafe6e85b46081366968da1a373c5 Mon Sep 17 00:00:00 2001 From: Lachlan Roberts Date: Thu, 10 Dec 2020 23:22:03 +1100 Subject: [PATCH 1/5] Issue #5785 - remove warning on CompressExtension failure Signed-off-by: Lachlan Roberts --- .../websocket/common/extensions/compress/CompressExtension.java | 1 - 1 file changed, 1 deletion(-) diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/CompressExtension.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/CompressExtension.java index 6952ccb67ea..a0a5c1f8fed 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/CompressExtension.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/CompressExtension.java @@ -441,7 +441,6 @@ public abstract class CompressExtension extends AbstractExtension notifyCallbackFailure(current.callback, x); // If something went wrong, very likely the compression context // will be invalid, so we need to fail this IteratingCallback. - LOG.warn(x); super.failed(x); } From 447823316da54172b50d11396b1cbfb6bd432965 Mon Sep 17 00:00:00 2001 From: Ludovic Orban Date: Thu, 17 Dec 2020 14:16:42 +0100 Subject: [PATCH 2/5] backport fix for ArithmeticException --- jetty-util/src/main/java/org/eclipse/jetty/util/Pool.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/Pool.java b/jetty-util/src/main/java/org/eclipse/jetty/util/Pool.java index 7fa2c441c98..9a9752cad47 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/Pool.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/Pool.java @@ -301,6 +301,11 @@ public class Pool implements AutoCloseable, Dumpable { LOGGER.ignore(e); size = entries.size(); + // Size can be 0 when the pool is in the middle of + // acquiring a connection while another thread + // removes the last one from the pool. + if (size == 0) + break; } index = (index + 1) % size; } From a4dc95aa79cff9be028d46176b14c54a14f0352a Mon Sep 17 00:00:00 2001 From: Ravi Kumar Date: Thu, 17 Dec 2020 21:27:03 +0530 Subject: [PATCH 3/5] Added JMX annotations for ScheduledExecutorScheduler Signed-off-by: Ravi Kumar --- .../thread/ScheduledExecutorScheduler.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ScheduledExecutorScheduler.java b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ScheduledExecutorScheduler.java index 8519e08c464..3407310773f 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ScheduledExecutorScheduler.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ScheduledExecutorScheduler.java @@ -25,6 +25,8 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import org.eclipse.jetty.util.StringUtil; +import org.eclipse.jetty.util.annotation.ManagedAttribute; +import org.eclipse.jetty.util.annotation.ManagedObject; import org.eclipse.jetty.util.annotation.Name; import org.eclipse.jetty.util.component.AbstractLifeCycle; import org.eclipse.jetty.util.component.Dumpable; @@ -37,6 +39,7 @@ import org.eclipse.jetty.util.component.Dumpable; * queue even if the task did not fire, which provides a huge benefit in the performance * of garbage collection in young generation. */ +@ManagedObject("A scheduler") public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Scheduler, Dumpable { private final String name; @@ -154,4 +157,22 @@ public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Sch return scheduledFuture.cancel(false); } } + + @ManagedAttribute("name of scheduler") + public String getName() + { + return name; + } + + @ManagedAttribute("is scheduler daemon") + public boolean isDaemon() + { + return daemon; + } + + @ManagedAttribute("number of scheduler threads") + public int getThreads() + { + return threads; + } } From 433f6127935a724b341b7a575b824d426eb30e37 Mon Sep 17 00:00:00 2001 From: Ravi Kumar Date: Fri, 18 Dec 2020 08:31:04 +0530 Subject: [PATCH 4/5] Made changes as per the review comments Signed-off-by: Ravi Kumar --- .../jetty/util/thread/ScheduledExecutorScheduler.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ScheduledExecutorScheduler.java b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ScheduledExecutorScheduler.java index 3407310773f..931936239cb 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ScheduledExecutorScheduler.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ScheduledExecutorScheduler.java @@ -39,7 +39,7 @@ import org.eclipse.jetty.util.component.Dumpable; * queue even if the task did not fire, which provides a huge benefit in the performance * of garbage collection in young generation. */ -@ManagedObject("A scheduler") +@ManagedObject public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Scheduler, Dumpable { private final String name; @@ -158,19 +158,19 @@ public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Sch } } - @ManagedAttribute("name of scheduler") + @ManagedAttribute("The name of the scheduler") public String getName() { return name; } - @ManagedAttribute("is scheduler daemon") + @ManagedAttribute("Whether the scheduler uses daemon threads") public boolean isDaemon() { return daemon; } - @ManagedAttribute("number of scheduler threads") + @ManagedAttribute("The number of scheduler threads") public int getThreads() { return threads; From 29c00ebdf565378f69655f5bc6de34b2861a23b7 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 24 Dec 2020 15:29:31 +0100 Subject: [PATCH 5/5] Issue #5725 Review preventers. (#5839) Note that any Preventer that is documented as being fixed prior to jdk11 should be deleted from jetty-10/11 when this change is merged through. Signed-off-by: Jan Bartel --- .../org/eclipse/jetty/util/preventers/DOMLeakPreventer.java | 3 +++ .../eclipse/jetty/util/preventers/GCThreadLeakPreventer.java | 3 +++ .../eclipse/jetty/util/preventers/Java2DLeakPreventer.java | 4 ++++ .../org/eclipse/jetty/util/preventers/LDAPLeakPreventer.java | 3 +++ .../util/preventers/LoginConfigurationLeakPreventer.java | 2 ++ .../jetty/util/preventers/SecurityProviderLeakPreventer.java | 3 +++ 6 files changed, 18 insertions(+) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/DOMLeakPreventer.java b/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/DOMLeakPreventer.java index 99f916faa99..564755b4ae7 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/DOMLeakPreventer.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/DOMLeakPreventer.java @@ -30,7 +30,10 @@ import javax.xml.parsers.DocumentBuilderFactory; * * Note that according to the bug report, a heap dump may not identify the GCRoot, making * it difficult to identify the cause of the leak. + * + * @deprecated reported as fixed in jdk 7, see https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6916498 */ +@Deprecated public class DOMLeakPreventer extends AbstractLeakPreventer { diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/GCThreadLeakPreventer.java b/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/GCThreadLeakPreventer.java index ef1641acaa5..ff339e65cbd 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/GCThreadLeakPreventer.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/GCThreadLeakPreventer.java @@ -34,7 +34,10 @@ import java.lang.reflect.Method; * RMI. * * Inspired by Tomcat JreMemoryLeakPrevention. + * + * @deprecated fixed in jdvm 9b130, see https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8157570 */ +@Deprecated public class GCThreadLeakPreventer extends AbstractLeakPreventer { diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/Java2DLeakPreventer.java b/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/Java2DLeakPreventer.java index f44310510b8..3fdb32e999c 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/Java2DLeakPreventer.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/Java2DLeakPreventer.java @@ -25,7 +25,11 @@ package org.eclipse.jetty.util.preventers; * before webapp classloaders are created. * * See https://issues.apache.org/bugzilla/show_bug.cgi?id=51687 + * + * @deprecated fixed in jdk 9, see https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6489540 + * */ +@Deprecated public class Java2DLeakPreventer extends AbstractLeakPreventer { diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/LDAPLeakPreventer.java b/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/LDAPLeakPreventer.java index 395684f3a37..267c827ffbc 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/LDAPLeakPreventer.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/LDAPLeakPreventer.java @@ -27,7 +27,10 @@ package org.eclipse.jetty.util.preventers; * load the LdapPoolManager. * * Inspired by Tomcat JreMemoryLeakPrevention + * + * @deprecated fixed in jdk 8u192 */ +@Deprecated public class LDAPLeakPreventer extends AbstractLeakPreventer { diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/LoginConfigurationLeakPreventer.java b/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/LoginConfigurationLeakPreventer.java index 4365e4e59e5..e3f6be132f9 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/LoginConfigurationLeakPreventer.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/LoginConfigurationLeakPreventer.java @@ -26,7 +26,9 @@ package org.eclipse.jetty.util.preventers; * that by invoking the classloading here. * * Inspired by Tomcat JreMemoryLeakPrevention + * @deprecated classloader does not seem to be held any more */ +@Deprecated public class LoginConfigurationLeakPreventer extends AbstractLeakPreventer { diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/SecurityProviderLeakPreventer.java b/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/SecurityProviderLeakPreventer.java index 3ca736ef1b5..f990850b2da 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/SecurityProviderLeakPreventer.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/preventers/SecurityProviderLeakPreventer.java @@ -28,7 +28,10 @@ import java.security.Security; * is not a webapp classloader. * * Inspired by Tomcat JreMemoryLeakPrevention + * + * @deprecated sun.security.pkcs11.SunPKCS11 class explicitly sets thread classloader to null */ +@Deprecated public class SecurityProviderLeakPreventer extends AbstractLeakPreventer {