Open georgyfarniev opened 5 years ago
Having the same issue... is there maybe some idea for a workaround?
Having the same issue... is there maybe some idea for a workaround?
@DanielDornhardt, you have to call resume after next tick. E.g.:
parser.on('endElement', async (elt, attrs) => {
count++
parser.stop()
executeSomePromise().then(parser.resume)
// or
nextTick(parser.resume)
})
It's not well documented, but I found it.
Hi @georgyfarniev , thank you for helping us out... I'm not sure if it'll work out yet but we're working on it.
Hello.
Thanks for creating this parser, it works fast and has nice documentation, really wonderful job. Unfortunately, I ran into issues with pausing stream. I need it for writing record to database before continuing.
I noticed incorrect behavior when I call stop/resume in closing tag handler, and I got out of memory crash on big xml file, but unfortunately I cannot provide this file, as it contains corporate information.
So, to reproduce, use scripts below. First script will generate large XML file, and second will show error. While there's 100000 records in sample.xml, parser will show less closed tags (in my case, 3274). If I remove stop and resume calls, it shows 100000 as it should.
On another file (which I cannot provide unfortunately) it causes out of memory crash. I will try to create auto-generated file which can reproduce this issue.
Sample generator:
Reproduce: