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

Large xml file - Maximum call stack size exceeded or JavaScript heap out of memory #187

Open
ibiris opened this issue Jun 20, 2019 · 1 comment

Comments

@ibiris
Copy link

ibiris commented Jun 20, 2019

I am trying to sign a rather large XML file which contains about 90000 IoT measurement elements (with sub elements including the measurement, metadata and timestamps) - this is a file of about 2 million lines. xml-crypto seems to sign XML files of up to 2500 elements but after that it starts complaining that

RangeError: Maximum call stack size exceeded
    at node_modules/xpath/xpath.js:2045:20
    at node_modules/xpath/xpath.js:131:34
    at node_modules/xpath/xpath.js:124:3
    at fn (node_modules/xpath/xpath.js:117:22)
    at node_modules/xpath/xpath.js :131:2
    at fn (node_modules/xpath/xpath.js:117:22)
    at Function.PathExpr.applySteps (node_modules/xpath/xpath.js:2044:9)
    at Function.PathExpr.applyLocationPath (node_modules/xpath/xpath.js:2078:21)
    at PathExpr.evaluate (node_modules/xpath/xpath.js:2091:23)
    at XPath.evaluate (node_modules/xpath/xpath.js:1317:25)

Trying with the full 90000 elements XML it fails due to javascript heap out of memory. All this is expected, since xml-crypto seems to read the entire file into memory and processes it as a block. Are there any plans to allow stream processing of XML (not sure if that is even possible with digital signature calculations)?

Are there other suggestions on what to do to handle such large files?

@cjbarth
Copy link
Contributor

cjbarth commented May 29, 2023

This seems to be a problem with xpath, not with xml-crypto. Have you looked at https://github.com/goto100/xpath to see if you can report the issue there?

I also see that this is forked from some work that @yaronn has done. Perhaps he'd be willing to work with us along with @JLRishe to get this addressed. If needed, we could probably even move it into the node-saml organization so that it can get more attention than it is now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants