Comments (14)
Detailed Explanation of the problem
My suspicion was correct. A detailed explanation of the issue is that JavaUtilLoggingLogger was doing the following:
- Creating an anonymous inner class of Formatter
- Since the Formatter was created with a custom ClassLoader (i.e. Gradle's MutableURLClassLoader) that class has a reference (i.e. Formatter.class.classLoader) to the custom ClassLoader
- A reference to that Formatter was then added to a java.util.logging.Logger instance which is statically cached by the system ClassLoader
- This means that the custom ClassLoader had a GC root within the system ClassLoader's static cache of the Logger instance and could not be GC'd.
Since the custom ClassLoader could not be GC'd then all the classes that were created by it (i.e class within the Gradle build) could not be GC'd either since each ClassLoader caches the classes it loads. This is what was causing the Perm Gen leak.
Of course depending on various code paths there could be other leaks, but this was the first one that I encountered.
Solution / Workaround
I think eventually we need to log a proper issue with JRuby team and have them remove the anonymous inner class. For now we can work around this by setting the following system property:
System.setProperty('jruby.logger.class','org.jruby.util.log.StandardErrorLogger')
For those experiencing the issue, they should be able to work around it by using the following doFirst closure:
asciidoctor {
// ...
doFirst {
System.setProperty('jruby.logger.class','org.jruby.util.log.StandardErrorLogger')
}
}
from asciidoctor-gradle-plugin.
Cool, if this is a problem which potentially can affect all users of AsciidoctorJ, not only the Gradle ones, then we could predefine this value during AsciidoctorJ startup time. For what I see this is a problem with JRuby first, but only affects Gradle users for now, but I am not sure that this could affect OSGi users too for example.
from asciidoctor-gradle-plugin.
I fully agree this is primarily a JRuby issue. I created an issue and Pull Request with JRuby.
This issue impacts users of JRuby that are running on a application server that do not restart the container between deploys of the application. In that instance the leak would occur due to the war's ClassLoader. Therefore, if we are wanting to provide a workaround by setting the system property (please let me know your thoughts here) I believe it makes the most sense to set the system property in AsciidoctorJ.
from asciidoctor-gradle-plugin.
Hi thank you so much for your research.
I think you have done a really good work, about next steps I think it would
depend on what JRuby folks will do. Do you think they will spend so much
time in merging and releasing a new version? If they act fast then we can
wait, if not we open an issue to asciidoctorj to create the workaround
El dilluns 25 de novembre de 2013, Rob Winch ha escrit:
@lordofthejars https://github.com/lordofthejars
I fully agree this is primarily a JRuby issue. I created an issuehttps://github.com/jruby/jruby/issues/1266and Pull
Request jruby/jruby#1267 with JRuby.This issue impacts users of JRuby that are running on a application server
that do not restart the container between deploys of the application. In
that instance the leak would occur due to the war's ClassLoader. Therefore,
if we are wanting to provide a workaround by setting the system property
(please let me know your thoughts here) I believe it makes the most sense
to set the system property in AsciidoctorJ.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/61#issuecomment-29220543
.
Enviat amb Gmail Mobile
from asciidoctor-gradle-plugin.
I'm not really certain how fast we will see it merged and released. I am fairly hopeful though since I have already gotten a +1 from one of the JRuby comitters to merge my PR
from asciidoctor-gradle-plugin.
Cool then for now and because users can still add the property by
themselves (as workaround of course) we can left as is and wait. If it
takes so time, then I will add to asciidoctorj. Has it sense?
2013/11/26 Rob Winch [email protected]
I'm not really certain how fast we will see it merged and released. I am
fairly hopeful though since I have already gotten a +1 from one of the
JRuby comitters to merge my PR—
Reply to this email directly or view it on GitHubhttps://github.com//issues/61#issuecomment-29301646
.
+----------------------------------------------------------+
Alex Soto Bueno - Computer Engineer
www.lordofthejars.com
+----------------------------------------------------------+
from asciidoctor-gradle-plugin.
That works for me :)
from asciidoctor-gradle-plugin.
+1
Thanks for tracking this down Rob! You nailed down the problem before it
even had a chance to cause too much disruption for users. \o/
I'll help lobby to get the patch merged.
Cheers!
-Dan
from asciidoctor-gradle-plugin.
Cool, as I suggested to Rob, if it takes more time that expected, I will patch AsciidoctorJ as a temporary workaround.
from asciidoctor-gradle-plugin.
Given the last exchange, should be close this issue and open another @ AsciidoctorJ ?
from asciidoctor-gradle-plugin.
Well It should be fixed in AsciidoctorJ as well asciidoctor/asciidoctorj#96 In next version you can remove the clone of the internal Map.
from asciidoctor-gradle-plugin.
Do we have a test case for this? Methinks this issue can be closed due to asciidoctorj-1.5.2 depends on JRuby 1.7.16.1
from asciidoctor-gradle-plugin.
It appears to have been resolved. Sorry I didn't mean to click close. I will leave that up to @aalmiray
from asciidoctor-gradle-plugin.
no worries @rwinch 😄
from asciidoctor-gradle-plugin.
Related Issues (20)
- Custom AsciidoctorTask task needs sourceDir HOT 1
- What's the way to expose "Last updated" to current time on footer tag in adoc?
- Cannot implement plugin by using task avoidance
- JavaExecSpec.main property deprecated warning and will be removed in Gradle 9.0
- Fix GEMs integration test under Windows
- Enable slides & slides-export projects
- Enable leanpub project
- Supplying closures to asciidoctorj.docExtensions causes execution issues
- Property "inProcess" is no longer available while updating to 4.0.0 HOT 3
- Can't use custom Gem (Bad file descriptor) HOT 2
- v4.0.0 compatibility issue with Java 8 HOT 8
- Invalid description in published POM HOT 5
- 4.0.x timeouts (runs out of memory?)
- Plugin includes multiple versions of the same dependency
- Unable to use 4.0 in precompiled script plugin HOT 6
- Allow null attributes to be passed through HOT 1
- Fails to require GEMs HOT 11
- Regression with missing task dependency for additional configurations
- Gems don't work with Gradle >= 8.7 HOT 8
- Collections are not allowed HOT 3
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 asciidoctor-gradle-plugin.