Memory leak when using p:xslt in 1.0.20 -> 1.0.23 #183

Closed
AdrianBuza opened this Issue Dec 18, 2014 · 5 comments

Comments

Projects
None yet
2 participants
@AdrianBuza

I tested and reproduced this in 1.0.20 -> 1.0.23.

We run XProc scripts repeatedly within the same Java process (not headless). After a few runs of scripts that use p:xslt, a significant amount of memory remains allocated that is directly proportional to the size of the input XML source file and the number of p:xslt steps.
This did not happen with 1.0.19 and earlier.

XProc (add more p:xslt steps to amplify the problem):

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="1.0">
    <p:input port="source"/>
    <p:output port="result"/>


    <!-- Step1. -->
    <p:xslt name="step1">
        <p:input port="source"/>
        <p:input port="stylesheet">
            <p:document href="dummy.xsl"/>
        </p:input>
        <p:input port="parameters">
            <p:empty/>
        </p:input>
    </p:xslt>

    <!-- Step2. -->
    <p:xslt name="step2">
        <p:input port="stylesheet">
            <p:document href="dummy.xsl"/>
        </p:input>
        <p:input port="parameters">
            <p:empty/>
        </p:input>
    </p:xslt>
    .... (more steps)
</p:declare-step>

XSL is not really relevant, but I'm including it here for completeness' sake, dummy.xsl:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml"/>
    <xsl:template match="/">
        <xsl:apply-templates/>
    </xsl:template>
    <xsl:template match="*"/>
</xsl:stylesheet>

Use a large input XML (>3MB) and check the Java heap after a few runs.

@AdrianBuza

This comment has been minimized.

Show comment
Hide comment
@AdrianBuza

AdrianBuza Mar 24, 2015

Hi,

Is there any feedback regarding this leak?
This is rather important for us at Oxygen, since XML Calabash runs within the Java process of our Oxygen application. This means that a memory leak stays with the application until it is restarted. After a few XProc runs that use p:xslt, the application may run out of memory due to the repeated leaks.

Regards,
Adrian

Hi,

Is there any feedback regarding this leak?
This is rather important for us at Oxygen, since XML Calabash runs within the Java process of our Oxygen application. This means that a memory leak stays with the application until it is restarted. After a few XProc runs that use p:xslt, the application may run out of memory due to the repeated leaks.

Regards,
Adrian

@ndw

This comment has been minimized.

Show comment
Hide comment
@ndw

ndw Mar 27, 2015

Owner

Top of my list, I promise. I've got some personal distractions this weekend (my mother is visiting :-) ) but I'll try to get this fixed next week. Certainly for the next release. Sorry about the delay.

Owner

ndw commented Mar 27, 2015

Top of my list, I promise. I've got some personal distractions this weekend (my mother is visiting :-) ) but I'll try to get this fixed next week. Certainly for the next release. Sorry about the delay.

@ndw

This comment has been minimized.

Show comment
Hide comment
@ndw

ndw Apr 3, 2015

Owner

Ok. I've found the issue. My first attempt at fixing it seems to cause a regression error in extension functions. As soon as I've nailed that down, I'll do another release.

Owner

ndw commented Apr 3, 2015

Ok. I've found the issue. My first attempt at fixing it seems to cause a regression error in extension functions. As soon as I've nailed that down, I'll do another release.

ndw added a commit that referenced this issue Apr 6, 2015

ndw added a commit that referenced this issue Apr 6, 2015

@ndw

This comment has been minimized.

Show comment
Hide comment
@ndw

ndw Apr 6, 2015

Owner

I believe this is fixed in 1.0.32 released today.

Owner

ndw commented Apr 6, 2015

I believe this is fixed in 1.0.32 released today.

@ndw ndw closed this Apr 6, 2015

@ndw

This comment has been minimized.

Show comment
Hide comment
@ndw

ndw Apr 6, 2015

Owner

Note that you must call runtime.close() when you're through using an XProcRuntime.

Owner

ndw commented Apr 6, 2015

Note that you must call runtime.close() when you're through using an XProcRuntime.

@bertfrees bertfrees referenced this issue in daisy/pipeline-tasks Mar 29, 2017

Open

Identify performance bottlenecks #71

2 of 3 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment