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

Invalid XML causes OOM #4

Open
garthk opened this issue Aug 9, 2016 · 1 comment
Open

Invalid XML causes OOM #4

garthk opened this issue Aug 9, 2016 · 1 comment

Comments

@garthk
Copy link

garthk commented Aug 9, 2016

$ node
> require('xmlpoke')('<test><![CDATA[hello]]</test>', xml => { return; })

<--- Last few GCs --->

   22170 ms: Mark-sweep 1290.6 (1349.6) -> 1290.6 (1350.6) MB, 1366.8 / 0 ms [allocation failure] [GC in old space requested].
   23550 ms: Mark-sweep 1290.6 (1350.6) -> 1290.6 (1350.6) MB, 1379.9 / 0 ms [last resort gc].
   24962 ms: Mark-sweep 1290.6 (1350.6) -> 1290.6 (1349.6) MB, 1411.4 / 0 ms [last resort gc].


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x3494ec2c9e31 <JS Object>
    1: appendChild […/node_modules/xmldom/dom.js:~731] [pc=0x32adbec0f6f9] (this=0xc07a6f0261 <an Element with map 0x1f279eb61539>,newChild=0x28dbf8e248d1 <a Text with map 0x1f279eb61489>)
    2: characters […/node_modules/xmlpoke/node_modules/xmldom/dom-parser.js:136] [pc=0x32adbec079e5] (this=0xc07a6ebdf9 <a DO...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

Node 6.3.1 on Mac OS X 10.11.6. xmldom's parseFromString survives:

$ node
> new (require('xmldom').DOMParser)().parseFromString('<test><![CDATA[hello]]</test>')
Document {
  implementation: { _features: {} },
  childNodes: 
…
@mikeobrien
Copy link
Owner

Thx for the info! I'll try to look at it when I can but I'm pretty swamped ATM so I'm not sure when I'll have time. I'd totally be open to a PR if you feel like tackling it.

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

No branches or pull requests

2 participants