Login  Register

Gradle plugin and permgen

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Gradle plugin and permgen

sebersole
I just started using Asciidoctor a little bit in the Hibernate build via the Gradle plugin.  But we are now experiencing pergen errors during the build.  I am not sure if that is Asciidoctor itself or if it is the total combination across DocBook + AsciiDoctor that is causing the problem (if I run either tasks by themselves they work fine).  

Has anyone else experienced this with asciidoctor-gradle-plugin?
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Gradle plugin and permgen

rwinch
I have also experienced issues with the Asciidoctor Gradle plugin and permgen. I'm not sure if this is a AsciidoctorJ issue
or a Asciidoctor Gradle plugin issue but I created a ticket to look into this [1]. In the meantime you can work around this
by ensuring the Gradle daemon is off (i.e. run with "./gradlew --nodaemon asciidoc").

[1] https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/61
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Gradle plugin and permgen

asotobu
We had it some problems with gradle plugin and asciidoctorj, but I think it wasn't a problem with permgen, but with attributes which requires to be cloned inside gradle. This will be fixed in next version so clone is not required anymore. I don't know if this could be the cause of permgen problem or not.
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Gradle plugin and permgen

rwinch
Thanks for the reply Alex. I think the issue is JRuby in combination with Gradle creating a new ClassLoader per execution. See the updated description of the issue for details. I don't have time to hunt down a solution at the moment, but hopefully will be able to sometime next week.
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Gradle plugin and permgen

rwinch
sebersole,

I found the issue (or at least one Permgen leak). I have added a comment on the issue with the full details. It would be nice if you could verify that the workaround fixes the issue for you. If not, I may need to get a sample document that recreates the issue. In short, the workaround is to add the following within your gradle build:

apply plugin: 'asciidoctor'

asciidoctor {
    // ...
    doFirst {
        System.setProperty('jruby.logger.class','org.jruby.util.log.StandardErrorLogger')
    }
}

Please let me know if this resolves your issue.

Cheers,
Rob
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Gradle plugin and permgen

sebersole
Problem is that I am not able to consistently reproduce this.  This morning I am not able to reproduce it at all.  So I cannot test out your work around
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Gradle plugin and permgen

rwinch
sebersole,

Thank you for your reply. Have you tried with the following steps? If not can you please try?

First make sure you are using the Gradle daemon. You can enable the Gradle daemon if you have the following defined in a file named gradle.properties in the root of your build (or in ~/.gradle/gradle.properties):

org.gradle.daemon=true

You should then be able to reproduce the crash consistently after after X times of running the build. For my very simple build it took about 15 tries, but this will vary depending on how many classes are being loaded by Gradle's ClassLoader.

I'm confident that I solved a leak for my particular build. This would certainly fix at least "a leak" for anyone using asciidoctor gradle plugin. However, I cannot be certain that it was the only leak and thus I cannot be certain it will resolve your issue completely.

Cheers,
Rob
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Gradle plugin and permgen

mojavelinux
Administrator

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.

Steve, I'm interested to hear if you still notice problems. If so, we'll stay on it until we get a resolution.

It's interesting how many things we're uncovering about the Java-JRuby integration. I only wish we'd get a bit more input from that team for how much of a workout it's getting here.

-Dan

On Nov 25, 2013 11:47 AM, "rwinch [via Asciidoctor :: Discussion]" <[hidden email]> wrote:
sebersole,

Thank you for your reply. Have you tried with the following steps? If not can you please try?

First make sure you are using the Gradle daemon. You can enable the Gradle daemon if you have the following defined in a file named gradle.properties in the root of your build (or in ~/.gradle/gradle.properties):

org.gradle.daemon=true

You should then be able to reproduce the crash consistently after after X times of running the build. For my very simple build it took about 15 tries, but this will vary depending on how many classes are being loaded by Gradle's ClassLoader.

I'm confident that I solved a leak for my particular build. This would certainly fix at least "a leak" for anyone using asciidoctor gradle plugin. However, I cannot be certain that it was the only leak and thus I cannot be certain it will resolve your issue completely.

Cheers,
Rob


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Gradle-plugin-and-permgen-tp1040p1092.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Gradle plugin and permgen

asotobu
As Dan suggest try the Rob approach and see if it still happens. Keep in mind that in next version we will provide a shutdown method to clean all JRuby stuff, which will be so useful because some users that are using long live applications are experiencing some permgem problems too because of JRuby environment was consuming all resources.

Moreover, in near future (1.6.0) I am planning that users will be able to share a common JRuby runtime across different applications, so for example you will be able to run AsciidoctorJ, TiltJ, ... over the same instance.

As usually, anything you find, write here and we take a look.