Comments (4)
I changed the implementation to catch all Exceptions ocurring during javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder(). The change is on GitHub but no JAR is available yet.
The ClassCastException will be logged as an error, however. Can you work with that, or do you still need to be able to override this?
from classloader-leak-prevention.
Hmmm, I don't really want a stack trace every time I deploy but I am already overriding the error(Throwable t) method and I could selectively suppress the stack trace in some cases. Since no message is passed in to the error method I don't really have much infomation to log (besides the stack trace) to tell me where the error occurred. If a message was passed in about what failed I could log something like "JAXP leak avoidance measure failed due to: " + e.getClass().getName() + " : " + e.getMessage().
I think passing a brief message to the error method and/or moving those contextInitialized blocks of code to protected methods would both be worthwhile. Those methods would also provide a good place for comments about the leak, without making the contextInitialized method really long.
I can work with this for now and if I get time I might provide a patch, at least for the error methods.
Regarding logging stack traces, I see you are avoiding logging a stack trace that occurs on JBoss. If there is a stack trace that occurs for a particular application, it is probably specific to a particular app server or JVM and chances are they will eventually want to suppress it, but still have access to the stack trace initially. Maybe a configuration option could be used to determine whether the listener logs stack traces for errors or just messages.
Thanks for creating this listener. I am still adding it to applications and eventually I will have to do the hard work to determine if the classloader leaks for all our applications are gone. That seems like it is going to be a painful process since you can't just deploy and undeploy an app, force a permgen GC and see if it worked. Between deploy and undeploy you have to excercise all the various functionality, frameworks, and libraries in the application that might cause a leak. Your listener does seem to get most types of leaks so another strategy might be to put the listener in all applications and then just deploy all apps to our development environment every night from Jenkins and if the servers stay up for a week then the leaks must be taken care of (assuming there is enough testing activity in dev to excercise the apps). If the JVM crashes then the heap dump can be analyzed per your instructions.
from classloader-leak-prevention.
The logger category, excetpion name, and exception message make the error I am logging descriptive enough and I have only seen an error on one application (which probably should be fixed in some way) so I am closing this issue.
from classloader-leak-prevention.
Glad to hear it worked out, since I didn't find the time to look at it further.
from classloader-leak-prevention.
Related Issues (20)
- Unavoidable SEVERE message: "Internal registry of java.beans.PropertyEditorManager not found" HOT 2
- endless print error:"Unexpected assignedDomains - please report to developer of this library!" HOT 3
- javax.swing.ImageIcon classloader leak
- ThreadLocal with SoftReference as value is not cleared HOT 1
- JURTKiller fails with java.lang.ClassNotFoundException: Illegal access using Tomcat 9
- java.beans.Introspector leaks again with JDK 9 to JDK 15
- Add java.io.ObjectStreamClass leak cleanup HOT 1
- Add capability to build and test with JDK up to version 17
- Remove finalize from RedefiningClassLoader
- Add jdk., and com.apple. to DEFAULT_IGNORED_PACKAGES HOT 4
- Catch and rethrow Throwable to prevent accidental leaks from SeparateClassLoaderInvokeMethod HOT 3
- Remove debug logging from the default output
- Rethrow exception from a failing test instead of analyzing leaks from the failing tests HOT 2
- Remove "JUnit used " + getTestClass().getJavaClass().getClassLoader() HOT 1
- Support Jakarta EE 9. NoClassDefFoundError: javax.servlet.ServletContextListener
- Strong references to inheritedAccessControlContext in java.lang.Thread cause classloader to be leaked HOT 2
- Poor extendability HOT 1
- Unreliable tests HOT 1
- JDK11 - llegal reflective access on Tomcat 9
- 2.7.0 not yet available on maven central HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from classloader-leak-prevention.