You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/10/18 23:24:39 UTC
[sling-org-apache-sling-extensions-classloader-leak-detector]
branch master created (now 1c512c6)
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-classloader-leak-detector.git.
at 1c512c6 SLING-7167 Adjust READMEs
This branch includes the following new commits:
new 1416970 SLING-3359 - Classloader Leak Detector Console Tab
new b265ba0 SLING-3359 - Classloader Leak Detector Console Tab
new 16b4691 SLING-3359 - Classloader Leak Detector Console Tab
new 1758892 SLING-3359 - Classloader Leak Detector Console Tab
new ae0684d [maven-release-plugin] prepare release org.apache.sling.extensions.classloader-leak-detector-1.0.0
new f0999f4 [maven-release-plugin] prepare for next development iteration
new 782fdbb add missing ASF header
new 5d788f5 fix license and some minor glitches
new c8cfeab Update to latest parent pom 20
new da4c95a Update to Sling Parent POM 22 with baselining enabled
new ac4aa1a Update contrib modules to Parent 23
new 3fbfc11 set parent version to 24 and add empty relativePath where missing
new 79b173a Update the contrib reactor to parent 25
new 5ccbe5d Switch to parent pom 26
new 1c512c6 SLING-7167 Adjust READMEs
The 15 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
--
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].
[sling-org-apache-sling-extensions-classloader-leak-detector]
13/15: Update the contrib reactor to parent 25
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-classloader-leak-detector.git
commit 79b173ac45ce81ad967cf5eb8c8aad6845d31f94
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Mon Oct 5 10:04:15 2015 +0000
Update the contrib reactor to parent 25
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1706781 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 6716871..4da5e8d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>24</version>
+ <version>25</version>
<relativePath/>
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-extensions-classloader-leak-detector]
03/15: SLING-3359 - Classloader Leak Detector Console Tab
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-classloader-leak-detector.git
commit 16b4691459b636fde4e28de0243a0ee5195c2617
Author: Chetan Mehrotra <ch...@apache.org>
AuthorDate: Tue Feb 11 10:57:09 2014 +0000
SLING-3359 - Classloader Leak Detector Console Tab
Adding a help message incase the JVM is not started with required VM options
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1567043 13f79535-47bb-0310-9956-ffa450edef68
---
.../leakdetector/internal/LeakDetector.java | 23 ++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/src/main/java/org/apache/sling/extensions/leakdetector/internal/LeakDetector.java b/src/main/java/org/apache/sling/extensions/leakdetector/internal/LeakDetector.java
index 1cca04c..fc951c7 100644
--- a/src/main/java/org/apache/sling/extensions/leakdetector/internal/LeakDetector.java
+++ b/src/main/java/org/apache/sling/extensions/leakdetector/internal/LeakDetector.java
@@ -1,6 +1,8 @@
package org.apache.sling.extensions.leakdetector.internal;
import java.io.PrintWriter;
+import java.lang.management.ManagementFactory;
+import java.lang.management.RuntimeMXBean;
import java.lang.ref.PhantomReference;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
@@ -196,6 +198,27 @@ public class LeakDetector implements Runnable, BundleActivator {
}
}
}
+ pw.println();
+
+ addHelp(pw);
+ }
+
+ private static void addHelp(PrintWriter pw){
+ RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean();
+ List<String> argList = bean.getInputArguments();
+
+ boolean containsRequiredArgs = argList.contains("-XX:+UseConcMarkSweepGC")
+ && argList.contains("-XX:+CMSClassUnloadingEnabled");
+
+ if(!containsRequiredArgs){
+ pw.println("Required VM Options Missing");
+ pw.println("===========================");
+ pw.println("Leak detector relies on garbage collection of classloaders. By default");
+ pw.println("the classloaders are not garbage collected. To enable garbage collection of");
+ pw.println("classloader start the JVM with following options ");
+ pw.println("");
+ pw.println(" -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled");
+ }
}
//~---------------------------------------<Data Model>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-extensions-classloader-leak-detector]
07/15: add missing ASF header
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-classloader-leak-detector.git
commit 782fdbb2ed280ba92f342d31902137fd83069aec
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon May 19 13:56:39 2014 +0000
add missing ASF header
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1595908 13f79535-47bb-0310-9956-ffa450edef68
---
.../extensions/leakdetector/internal/LeakDetector.java | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/main/java/org/apache/sling/extensions/leakdetector/internal/LeakDetector.java b/src/main/java/org/apache/sling/extensions/leakdetector/internal/LeakDetector.java
index fc951c7..a73bd9a 100644
--- a/src/main/java/org/apache/sling/extensions/leakdetector/internal/LeakDetector.java
+++ b/src/main/java/org/apache/sling/extensions/leakdetector/internal/LeakDetector.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.sling.extensions.leakdetector.internal;
import java.io.PrintWriter;
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-extensions-classloader-leak-detector]
08/15: fix license and some minor glitches
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-classloader-leak-detector.git
commit 5d788f5227c07f73a139be6a05ab5a7ce99ddb99
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Wed Jun 18 10:30:21 2014 +0000
fix license and some minor glitches
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1603399 13f79535-47bb-0310-9956-ffa450edef68
---
README.md | 16 ++++++++--------
pom.xml | 43 +++++++++++++++++++++----------------------
2 files changed, 29 insertions(+), 30 deletions(-)
diff --git a/README.md b/README.md
index 3de6411..4b83aa7 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,12 @@
-Sling Classloader Leak Detector
-===============================
+Apache Sling Classloader Leak Detector
+======================================
This bundle provides support for tracing classloader leaks which occur due to
-improper cleanup in bundles. Refer to [SLING-3359][1] for background details
+improper cleanup in bundles. Refer to [SLING-3359][1] for background details.
The bundle registers a Felix Configuration Printer which dumps out a list of
-suspected classloaders which are not getting garbage collected. it can be accessed
-at http://localhost:8080/system/console/status-leakdetector
+suspected classloaders which are not getting garbage collected.
+It can be accessed at http://localhost:8080/system/console/status-leakdetector
Possible classloader leak detected
Number of suspicious bundles - 1
@@ -19,9 +19,9 @@ at http://localhost:8080/system/console/status-leakdetector
### JVM Arguments
By default on Oracle JDK the classloaders and related classes from Permgen are
- not garbage collected by default. This bundle relies on Classloaders getting
- gced for it work. So to enable that pass on following arguments
+ not garbage collected by default. This bundle relies on classloaders getting
+ garbage collected for it work. So to enable that pass on following arguments
-XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled
-[1]: https://issues.apache.org/jira/browse/SLING-3359
\ No newline at end of file
+[1]: https://issues.apache.org/jira/browse/SLING-3359
diff --git a/pom.xml b/pom.xml
index c02c5a2..4243574 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,38 +1,37 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
<!--
-/*************************************************************************
- *
- * ADOBE CONFIDENTIAL
- * __________________
- *
- * Copyright 2012 Adobe Systems Incorporated
- * All Rights Reserved.
- *
- * NOTICE: All information contained herein is, and remains
- * the property of Adobe Systems Incorporated and its suppliers,
- * if any. The intellectual and technical concepts contained
- * herein are proprietary to Adobe Systems Incorporated and its
- * suppliers and are protected by trade secret or copyright law.
- * Dissemination of this information or reproduction of this material
- * is strictly forbidden unless prior written permission is obtained
- * from Adobe Systems Incorporated.
- **************************************************************************/
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>18</version>
+ <version>19</version>
</parent>
<artifactId>org.apache.sling.extensions.classloader-leak-detector</artifactId>
<packaging>bundle</packaging>
<version>1.0.1-SNAPSHOT</version>
- <name>Adobe Sling ClassLoader Leak Detector</name>
+ <name>Apache Sling ClassLoader Leak Detector</name>
<description>
Provides a web console configuration printer to provide details around classloader leaks
</description>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-extensions-classloader-leak-detector]
14/15: Switch to parent pom 26
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-classloader-leak-detector.git
commit 5ccbe5d915d1212efeb989e1b687717561e86543
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Sun Jan 3 14:07:46 2016 +0000
Switch to parent pom 26
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1722720 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 4da5e8d..99062ac 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>25</version>
+ <version>26</version>
<relativePath/>
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-extensions-classloader-leak-detector]
09/15: Update to latest parent pom 20
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-classloader-leak-detector.git
commit c8cfeab5542aeaa0e8f75013eb17e3d45aa7fbb4
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Sep 2 14:49:28 2014 +0000
Update to latest parent pom 20
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1622027 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 4243574..1ada2a5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>19</version>
+ <version>20</version>
</parent>
<artifactId>org.apache.sling.extensions.classloader-leak-detector</artifactId>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-extensions-classloader-leak-detector]
05/15: [maven-release-plugin] prepare release
org.apache.sling.extensions.classloader-leak-detector-1.0.0
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-classloader-leak-detector.git
commit ae0684d6ba581012d3ca5de770ced1493ba12c0c
Author: Chetan Mehrotra <ch...@apache.org>
AuthorDate: Thu May 15 06:02:47 2014 +0000
[maven-release-plugin] prepare release org.apache.sling.extensions.classloader-leak-detector-1.0.0
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1594775 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index 3874a37..8dd1bb8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@
<artifactId>org.apache.sling.extensions.classloader-leak-detector</artifactId>
<packaging>bundle</packaging>
- <version>0.0.1-SNAPSHOT</version>
+ <version>1.0.0</version>
<name>Adobe Sling ClassLoader Leak Detector</name>
<description>
@@ -38,10 +38,10 @@
</description>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/leak-detector</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/leak-detector
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.extensions.classloader-leak-detector-1.0.0</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.extensions.classloader-leak-detector-1.0.0
</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/leak-detector</url>
+ <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.extensions.classloader-leak-detector-1.0.0</url>
</scm>
<build>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-extensions-classloader-leak-detector]
12/15: set parent version to 24 and add empty relativePath where missing
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-classloader-leak-detector.git
commit 3fbfc11559da51089c381779a2f68354f3e6177a
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Jul 7 07:36:29 2015 +0000
set parent version to 24 and add empty relativePath where missing
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1689588 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index dea5238..6716871 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,8 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>23</version>
+ <version>24</version>
+ <relativePath/>
</parent>
<artifactId>org.apache.sling.extensions.classloader-leak-detector</artifactId>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-extensions-classloader-leak-detector]
15/15: SLING-7167 Adjust READMEs
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-classloader-leak-detector.git
commit 1c512c66f9f4641cac000824e5884c6572d6e676
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Oct 3 10:03:47 2017 +0000
SLING-7167 Adjust READMEs
add uniform header linking to Sling project
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1810899 13f79535-47bb-0310-9956-ffa450edef68
---
README.md | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 4b83aa7..1b7568d 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,6 @@
-Apache Sling Classloader Leak Detector
-======================================
+# Apache Sling ClassLoader Leak Detector
+
+This module is part of the [Apache Sling](https://sling.apache.org) project.
This bundle provides support for tracing classloader leaks which occur due to
improper cleanup in bundles. Refer to [SLING-3359][1] for background details.
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-extensions-classloader-leak-detector]
02/15: SLING-3359 - Classloader Leak Detector Console Tab
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-classloader-leak-detector.git
commit b265ba0eb6196de45a15240ffb89b08fbcd4adf9
Author: Chetan Mehrotra <ch...@apache.org>
AuthorDate: Mon Feb 10 12:42:45 2014 +0000
SLING-3359 - Classloader Leak Detector Console Tab
adding some comments and also ensuring that PhantomReference are properly cleared
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1566596 13f79535-47bb-0310-9956-ffa450edef68
---
.../extensions/leakdetector/internal/LeakDetector.java | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/sling/extensions/leakdetector/internal/LeakDetector.java b/src/main/java/org/apache/sling/extensions/leakdetector/internal/LeakDetector.java
index 38e4446..1cca04c 100644
--- a/src/main/java/org/apache/sling/extensions/leakdetector/internal/LeakDetector.java
+++ b/src/main/java/org/apache/sling/extensions/leakdetector/internal/LeakDetector.java
@@ -29,7 +29,10 @@ import org.slf4j.LoggerFactory;
public class LeakDetector implements Runnable, BundleActivator {
/**
- * Set of PhantomReferences such that PhantomReference itself is not GC
+ * Set of PhantomReferences such that PhantomReference itself is not GC.
+ * While analyzing the Heap Dump it might appear that GC roots of such classloaders (suspected)
+ * points to LeakDetector. This happens because they are held here through PhantomReference
+ * and there normal GC has not been done. So consider that as false positive
*/
private final Set<Reference<?>> refs = Collections.synchronizedSet(new HashSet<Reference<?>>());
@@ -124,7 +127,10 @@ public class LeakDetector implements Runnable, BundleActivator {
log.info("Shutting down reference collector for Classloader LeakDetector");
//Drain out the queue
- while (queue.poll() != null);
+ BundleReference ref = null;
+ while ((ref = (BundleReference)queue.poll()) != null){
+ removeBundle(ref);
+ }
}
private void removeBundle(BundleReference ref) {
@@ -134,6 +140,7 @@ public class LeakDetector implements Runnable, BundleActivator {
//bi cannot be null
bi.decrementUsageCount(ref);
refs.remove(ref);
+ ref.clear();
}
log.info("Detected garbage collection of bundle [{}] - Classloader [{}]", bi, ref.classloaderInfo);
@@ -240,6 +247,12 @@ public class LeakDetector implements Runnable, BundleActivator {
private static class ClassloaderInfo implements Comparable<ClassloaderInfo> {
final Long creationTime = System.currentTimeMillis();
+ /**
+ * The hashCode might collide for two different classloaders but then
+ * we cannot keep a hard reference to Classloader reference. So at best
+ * we keep the systemHashCode and *assume* it is unqiue at least wrt
+ * classloader instances
+ */
final long systemHashCode;
private ClassloaderInfo(ClassLoader cl) {
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-extensions-classloader-leak-detector]
10/15: Update to Sling Parent POM 22 with baselining enabled
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-classloader-leak-detector.git
commit da4c95aff2d0e8b5e8b61680639404ca010360b3
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Oct 1 06:52:29 2014 +0000
Update to Sling Parent POM 22 with baselining enabled
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1628620 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 1ada2a5..11c084d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>20</version>
+ <version>22</version>
</parent>
<artifactId>org.apache.sling.extensions.classloader-leak-detector</artifactId>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-extensions-classloader-leak-detector]
06/15: [maven-release-plugin] prepare for next development iteration
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-classloader-leak-detector.git
commit f0999f447a7662004a3a16703d468d1acffbfc7a
Author: Chetan Mehrotra <ch...@apache.org>
AuthorDate: Thu May 15 06:03:04 2014 +0000
[maven-release-plugin] prepare for next development iteration
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1594777 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index 8dd1bb8..c02c5a2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@
<artifactId>org.apache.sling.extensions.classloader-leak-detector</artifactId>
<packaging>bundle</packaging>
- <version>1.0.0</version>
+ <version>1.0.1-SNAPSHOT</version>
<name>Adobe Sling ClassLoader Leak Detector</name>
<description>
@@ -38,10 +38,10 @@
</description>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.extensions.classloader-leak-detector-1.0.0</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.extensions.classloader-leak-detector-1.0.0
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/leak-detector</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/leak-detector
</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.extensions.classloader-leak-detector-1.0.0</url>
+ <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/leak-detector</url>
</scm>
<build>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-extensions-classloader-leak-detector]
01/15: SLING-3359 - Classloader Leak Detector Console Tab
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-classloader-leak-detector.git
commit 14169705f4b4e5a772f4ead22cbd3ccb257bee4e
Author: Chetan Mehrotra <ch...@apache.org>
AuthorDate: Fri Jan 31 11:52:08 2014 +0000
SLING-3359 - Classloader Leak Detector Console Tab
Initial commit.
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1563112 13f79535-47bb-0310-9956-ffa450edef68
---
README.md | 27 ++
pom.xml | 83 ++++++
.../leakdetector/internal/LeakDetector.java | 304 +++++++++++++++++++++
3 files changed, 414 insertions(+)
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..3de6411
--- /dev/null
+++ b/README.md
@@ -0,0 +1,27 @@
+Sling Classloader Leak Detector
+===============================
+
+This bundle provides support for tracing classloader leaks which occur due to
+improper cleanup in bundles. Refer to [SLING-3359][1] for background details
+
+The bundle registers a Felix Configuration Printer which dumps out a list of
+suspected classloaders which are not getting garbage collected. it can be accessed
+at http://localhost:8080/system/console/status-leakdetector
+
+ Possible classloader leak detected
+ Number of suspicious bundles - 1
+
+ * org.apache.sling.sample.leakdetector.bad-bundle (0.0.1.SNAPSHOT) - Classloader Count [2]
+ - Bundle Id - 204
+ - Leaked classloaders
+ - Identity HashCode - 4a273519, Creation time 31.01.2014 15:22:58.407
+
+### JVM Arguments
+
+ By default on Oracle JDK the classloaders and related classes from Permgen are
+ not garbage collected by default. This bundle relies on Classloaders getting
+ gced for it work. So to enable that pass on following arguments
+
+ -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled
+
+[1]: https://issues.apache.org/jira/browse/SLING-3359
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..537b8e2
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0"?>
+<!--
+/*************************************************************************
+ *
+ * ADOBE CONFIDENTIAL
+ * __________________
+ *
+ * Copyright 2012 Adobe Systems Incorporated
+ * All Rights Reserved.
+ *
+ * NOTICE: All information contained herein is, and remains
+ * the property of Adobe Systems Incorporated and its suppliers,
+ * if any. The intellectual and technical concepts contained
+ * herein are proprietary to Adobe Systems Incorporated and its
+ * suppliers and are protected by trade secret or copyright law.
+ * Dissemination of this information or reproduction of this material
+ * is strictly forbidden unless prior written permission is obtained
+ * from Adobe Systems Incorporated.
+ **************************************************************************/
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>sling</artifactId>
+ <version>18</version>
+ </parent>
+
+ <artifactId>org.apache.sling.extensions.classloader-leak-detector</artifactId>
+ <packaging>bundle</packaging>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <name>Adobe Sling ClassLoader Leak Detector</name>
+ <description>
+ Provides a web console configuration printer to provide details around classloader leaks
+ </description>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/leak-detector</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/leak-detector
+ </developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/leak-detector</url>
+ </scm>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Activator>org.apache.sling.extensions.leakdetector.internal.LeakDetector</Bundle-Activator>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>4.3.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.3.0</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/src/main/java/org/apache/sling/extensions/leakdetector/internal/LeakDetector.java b/src/main/java/org/apache/sling/extensions/leakdetector/internal/LeakDetector.java
new file mode 100644
index 0000000..38e4446
--- /dev/null
+++ b/src/main/java/org/apache/sling/extensions/leakdetector/internal/LeakDetector.java
@@ -0,0 +1,304 @@
+package org.apache.sling.extensions.leakdetector.internal;
+
+import java.io.PrintWriter;
+import java.lang.ref.PhantomReference;
+import java.lang.ref.Reference;
+import java.lang.ref.ReferenceQueue;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Dictionary;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.Constants;
+import org.osgi.framework.wiring.BundleWiring;
+import org.osgi.util.tracker.BundleTracker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LeakDetector implements Runnable, BundleActivator {
+ /**
+ * Set of PhantomReferences such that PhantomReference itself is not GC
+ */
+ private final Set<Reference<?>> refs = Collections.synchronizedSet(new HashSet<Reference<?>>());
+
+ /**
+ * Lock to control concurrent access to internal data structures
+ */
+ private final Object leakDetectorLock = new Object();
+
+ private final ReferenceQueue<ClassLoader> queue = new ReferenceQueue<ClassLoader>();
+
+ private final ConcurrentMap<Long, BundleInfo> bundleInfos = new ConcurrentHashMap<Long, BundleInfo>();
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ private Thread referencePoller;
+
+ private BundleContext context;
+
+ private BundleTracker bundleTracker;
+
+ public void start(BundleContext context) {
+ this.context = context;
+ this.bundleTracker = new LeakDetectorBundleTracker(context);
+
+ referencePoller = new Thread(this, "Bundle Leak Detector Thread");
+ referencePoller.setDaemon(true);
+ referencePoller.start();
+
+ Dictionary<String,Object> printerProps = new Hashtable<String, Object>();
+ printerProps.put(Constants.SERVICE_VENDOR, "Apache Software Foundation");
+ printerProps.put(Constants.SERVICE_DESCRIPTION, "Sling Log Configuration Printer");
+ printerProps.put("felix.webconsole.label", "leakdetector");
+ printerProps.put("felix.webconsole.title", "Classloader Leak Detector");
+ printerProps.put("felix.webconsole.configprinter.modes", "always");
+
+ context.registerService(LeakDetector.class.getName(), this, printerProps);
+ }
+
+ public void stop(BundleContext context) {
+ this.bundleTracker.close();
+ referencePoller.interrupt();
+ }
+
+ private class LeakDetectorBundleTracker extends BundleTracker {
+ public LeakDetectorBundleTracker(BundleContext context) {
+ //Only listen for started
+ super(context, Bundle.ACTIVE, null);
+ this.open();
+ }
+
+ @Override
+ public Object addingBundle(Bundle bundle, BundleEvent event) {
+ synchronized (leakDetectorLock) {
+ registerBundle(bundle);
+ }
+ return bundle;
+ }
+ }
+
+ private void registerBundle(Bundle bundle) {
+ ClassLoader cl = getClassloader(bundle);
+ //cl would be null for Fragment bundle
+ if (cl != null) {
+ BundleReference ref = new BundleReference(bundle, cl);
+ refs.add(ref);
+
+ //Note that a bundle can be started multiple times
+ //for e.g. when refreshed So we need to account for that also
+ BundleInfo bi = bundleInfos.get(bundle.getBundleId());
+ if (bi == null) {
+ bi = new BundleInfo(bundle);
+ bundleInfos.put(bundle.getBundleId(), bi);
+ }
+ bi.incrementUsageCount(ref);
+ log.info("Registered bundle [{}] with Classloader [{}]", bi, ref.classloaderInfo);
+ }
+ }
+
+ //~----------------------------------------<GC Callback>
+
+ public void run() {
+ while (!Thread.currentThread().isInterrupted()) {
+ try {
+ BundleReference ref = (BundleReference) queue.remove();
+ if (ref != null) {
+ removeBundle(ref);
+ }
+ } catch (InterruptedException e) {
+ break;
+ }
+ }
+
+ log.info("Shutting down reference collector for Classloader LeakDetector");
+ //Drain out the queue
+ while (queue.poll() != null);
+ }
+
+ private void removeBundle(BundleReference ref) {
+ BundleInfo bi = bundleInfos.get(ref.bundleId);
+
+ synchronized (leakDetectorLock){
+ //bi cannot be null
+ bi.decrementUsageCount(ref);
+ refs.remove(ref);
+ }
+
+ log.info("Detected garbage collection of bundle [{}] - Classloader [{}]", bi, ref.classloaderInfo);
+ }
+
+
+
+ //~---------------------------------------<Configuration Printer>
+
+ /**
+ * @see org.apache.felix.webconsole.ConfigurationPrinter#printConfiguration(java.io.PrintWriter)
+ */
+ @SuppressWarnings("UnusedDeclaration")
+ public void printConfiguration(PrintWriter pw) {
+ //Try to force GC
+ //TODO Should we do by default or let user do it explicitly via
+ //Felix Web Console
+ //System.gc();
+
+ Set<Long> activeBundleIds = new HashSet<Long>();
+ for (Bundle b : context.getBundles()) {
+ activeBundleIds.add(b.getBundleId());
+ }
+
+ List<BundleInfo> suspiciousBundles = new ArrayList<BundleInfo>(bundleInfos.values());
+ Iterator<BundleInfo> itr = suspiciousBundles.iterator();
+ while (itr.hasNext()) {
+ BundleInfo bi = itr.next();
+
+ //Filter out bundles which are active and have
+ //only one classloader created for them
+ if (bi.hasSingleInstance()
+ && activeBundleIds.contains(bi.bundleId)) {
+ itr.remove();
+ }
+ }
+
+ if (suspiciousBundles.isEmpty()) {
+ pw.println("No classloader leak detected");
+ } else {
+ pw.println("Possible classloader leak detected");
+ pw.printf("Number of suspicious bundles - %d %n", suspiciousBundles.size());
+ pw.println();
+
+ final String tab = " ";
+
+ for(BundleInfo bi : suspiciousBundles){
+ pw.printf("* %s %n", bi);
+ pw.printf("%s - Bundle Id - %d %n", tab, bi.bundleId);
+ pw.printf("%s - Leaked classloaders %n", tab);
+ for(ClassloaderInfo ci : bi.leakedClassloaders()){
+ pw.printf("%s%s - %s %n", tab, tab, ci);
+ }
+ }
+ }
+ }
+
+ //~---------------------------------------<Data Model>
+
+ private static class BundleInfo {
+ final String symbolicName;
+ final String version;
+ final long bundleId;
+ private final Set<ClassloaderInfo> classloaderInfos =
+ Collections.synchronizedSet(new HashSet<ClassloaderInfo>());
+
+ public BundleInfo(Bundle b) {
+ this.symbolicName = b.getSymbolicName();
+ this.version = b.getVersion().toString();
+ this.bundleId = b.getBundleId();
+ }
+
+ public synchronized void incrementUsageCount(BundleReference ref) {
+ classloaderInfos.add(ref.classloaderInfo);
+ }
+
+ public synchronized void decrementUsageCount(BundleReference ref) {
+ classloaderInfos.remove(ref.classloaderInfo);
+ }
+
+ public synchronized boolean hasSingleInstance() {
+ return classloaderInfos.size() == 1;
+ }
+
+ public synchronized List<ClassloaderInfo> leakedClassloaders(){
+ if(hasSingleInstance()){
+ return new ArrayList<ClassloaderInfo>(classloaderInfos);
+ }else{
+ List<ClassloaderInfo> cis = new ArrayList<ClassloaderInfo>(classloaderInfos);
+ Collections.sort(cis);
+
+ //Leave out the latest classloader entry as that is
+ //associated with running bundle
+ return cis.subList(0, cis.size() - 1);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return String.format("%s (%s) - Classloader Count [%s]", symbolicName,
+ version, classloaderInfos.size());
+ }
+ }
+
+ private static class ClassloaderInfo implements Comparable<ClassloaderInfo> {
+ final Long creationTime = System.currentTimeMillis();
+ final long systemHashCode;
+
+ private ClassloaderInfo(ClassLoader cl) {
+ this.systemHashCode = System.identityHashCode(cl);
+ }
+
+ public int compareTo(ClassloaderInfo o) {
+ return creationTime.compareTo(o.creationTime);
+ }
+
+ public String getAddress(){
+ return Long.toHexString(systemHashCode);
+ }
+
+ public String getCreationDate(){
+ SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss.SSS");
+ return dateFormat.format(new Date(creationTime));
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ ClassloaderInfo that = (ClassloaderInfo) o;
+
+ if (systemHashCode != that.systemHashCode) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return (int) (systemHashCode ^ (systemHashCode >>> 32));
+ }
+
+ @Override
+ public String toString() {
+ return String.format("Identity HashCode - %s, Creation time %s", getAddress(), getCreationDate());
+ }
+ }
+
+ private class BundleReference extends PhantomReference<ClassLoader> {
+ final Long bundleId;
+ final ClassloaderInfo classloaderInfo;
+
+ public BundleReference(Bundle bundle, ClassLoader cl) {
+ super(cl, queue);
+ this.bundleId = bundle.getBundleId();
+ this.classloaderInfo = new ClassloaderInfo(cl);
+ }
+ }
+
+ private static ClassLoader getClassloader(Bundle b) {
+ //Somehow it fails to compile on JDK 7. Explicit cast helps
+ BundleWiring bw = (BundleWiring) b.adapt(BundleWiring.class);
+ if(bw != null){
+ return bw.getClassLoader();
+ }
+ return null;
+ }
+}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-extensions-classloader-leak-detector]
11/15: Update contrib modules to Parent 23
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-classloader-leak-detector.git
commit ac4aa1afc7f7812ff3e51016ca93d07ab16df085
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Thu Jun 25 13:10:59 2015 +0000
Update contrib modules to Parent 23
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1687503 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 11c084d..dea5238 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>22</version>
+ <version>23</version>
</parent>
<artifactId>org.apache.sling.extensions.classloader-leak-detector</artifactId>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-extensions-classloader-leak-detector]
04/15: SLING-3359 - Classloader Leak Detector Console Tab
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-classloader-leak-detector.git
commit 1758892cb60b6d62591da287d58288e00d070d30
Author: Chetan Mehrotra <ch...@apache.org>
AuthorDate: Thu May 15 05:58:54 2014 +0000
SLING-3359 - Classloader Leak Detector Console Tab
Preparing for release. Fixing the xml formatting
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1594774 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 537b8e2..3874a37 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,8 +18,7 @@
* from Adobe Systems Incorporated.
**************************************************************************/
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.