Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed validation leads to memory leak #126

Closed
ncrofts opened this issue Oct 7, 2013 · 1 comment
Closed

Failed validation leads to memory leak #126

ncrofts opened this issue Oct 7, 2013 · 1 comment

Comments

@ncrofts
Copy link

@ncrofts ncrofts commented Oct 7, 2013

While running pipelines using validate-with-xml-schema, we have found that exceptions thrown when the XML document fails to meet the schema cause a memory leak. In fact it would seem that in general if any processor throws an exception within a pipeline that a memory leak can result.

We have investigated the cause of this and it appears the leaks are being caused by a failure to clean up the data associated with the XProcData object. For example we have found several occurrences of the following sort of code:

XProcData data = runtime.getXProcData();
data.openFrame(this);

...calls a method that throws an exception e.g. xstep.run()

data.closeFrame();  // Does not get called after exception thrown, leading to a memory leak

It seems this pattern is repeated in several of the classes, including:

XAtomicStep.java
XChoose.java
XCompoundStep.java
XPipeline.java

A workaround to this would be to move the closeFrame() call into a finally block.

Please let me know if any more information would be helpful.

@ndw
Copy link
Owner

@ndw ndw commented Oct 23, 2013

Right you are. Fixed for the next release. (I'll close this bug after the fix is committed.)

ndw added a commit that referenced this issue Oct 28, 2013
…ntime stack frame; also make sure we call finish
ndw added a commit that referenced this issue Oct 28, 2013
…ntime stack frame; also make sure we call finish
@ndw ndw closed this Oct 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.