-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix a handful of streaming parser bugs #1570
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
base: master
Are you sure you want to change the base?
Conversation
Siemienik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @contra, Thank you for the great contribution :) Great job 🥇
Could I please you to do two points?
- Why test on MacOS with node v10 & v12 fails?
- Update this branch to the current master.
As these changes are major (min node version), I suppose we should separate major changes from another. To protect backwards-compatibility.
Additionally, I wan't to merge it without other contribution also approve major changes.
I'm contributing ExcelJS just for fun. If want you to know something more go into #1500
| entries: 'ignore', | ||
| hyperlinks: 'cache', | ||
| styles: 'cache', | ||
| entries: 'emit', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose that you have important reason here, so could I please you to explain, why changing these settings is obviusly? I'm little worried about losing performance here.
Imo, change defaults parameters should fails tests, what doesn't happen, hmm...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Siemienik I was asked to do this by @alubbe #1531 - the docs do not currently match the implementation, so this makes the implementation match the docs which is the intended behavior.
lib/stream/xlsx/workbook-reader.js
Outdated
| async *flushQueue(force) { | ||
| if (!force && !this.isDirectReady()) return; // not ready yet! do nothing | ||
| if (this.waitingWorkSheets.length === 0) return; // queue flushed! | ||
| const queue = this.waitingWorkSheets; // make a copy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I propose to pass waitingWorkSheets as an argument? It should be much safer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Siemienik flushQueue can be called multiple times asynchronously so there needs to be some mutable shared state with the worksheet queue on it - the alternative here would be passing an object in with the queue from the parent function. Based on everything else in this library it looked like mutable state living on the class was the preferred pattern.
| if (!this.parseClose(value.name)) { | ||
| return this.model; | ||
| } | ||
| if (!this.parseClose(value.name)) break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which issue is it fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Fixes a stall (unreported?) in the BaseXForm parser - if closetag was encountered it would return, and the sax parser would fail to flush and just pause forever. The correct behavior should be to break so that it flushes the parser correctly."
| let stream; | ||
| if (entryName.match(/xl\/media\//) || | ||
| if ( | ||
| entryName.match(/xl\/media\//) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which issue is it fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this was just from running the project linter, if not I can revert this
|
@Siemienik Most of these changes are not going to be easy to land in a node 8 compatible way so I would suggest releasing this as a major or a part of the next major if one is planned. If anyone feels strongly that this needs to be done in a node 8 compatible way feel free to amend this PR but I don't have the capacity to take that on, this was already a significant amount of debugging and work to sort this out. |
24d322d to
4dcf2de
Compare
|
@Siemienik Rebased and addressed the PR feedback. For the Mac issue - not sure, would have to look into how github runs their mac tests. It is pretty weird for it to fail only on mac when this entire suite is pretty OS independent. |
|
@yocontra @Siemienik is there any progress on this one? Is there anything I can do on my side to get this moved and merged? |
|
I would like too. However I am overloaded with my regular job. |
|
@jcalderonzumba Could you test my fork against your workload and see if it resolves your issues? That would be helpful. It looks like https://github.com/coursebase/exceljs is also a fork that incorporates my changes in this PR and some other fixes (unzipper) that were causing streaming issues. |
|
@Siemienik do you think there is a chance to review this pr and merge it? |
|
I fully understand that sometimes time is lacking to maintain a library and that everybody here is working for free. But honestly these fixes are pretty important, IMO either these are fixed or the library should be considered as abandoned. At least there should be a disclaimer in the doc about the streaming parser having known issues, and the default options should be documented properly (styles being 'ignore' while documented as 'cache' is pretty bad). Is there any hope of seeing this merged anytime ? Or does someone know a maintained fork that includes these fixes ? |
|
@albanm You can always stick "github:yocontra/exceljs#fix-streams" in your package.json as the version to use this PR's version. |
|
is there any update on this, I really need this fixed parser 😢 |
|
@yocontra I tried using your fork, but it still has a problem unless you opened and resaved the file, was this resolved? Thanks. |
|
@Siemienik: This fix solves the issue we face as well (verified with "github:yocontra/exceljs#fix-streams"). Would really appreciate a final review and merge. Thanks a lot! |
|
Hello. Any changes on this PR? |
|
Would one of the maintainers want to take over this PR and get it across the finish line? It seems like it needs some very minor love. Due to a new role I'm not able to allocate any time to this - but would like to see it land eventually since we've been going back and forth on it (and me rebasing it) for a little over 4 years. Totally understand if maintainers are busy and maybe somebody else wants to fork off my branch and resubmit instead. |
|
@yocontra I used |
Summary
We use the streaming parser and encountered a number of issues - sometimes files would stall out, sometimes they would always fail unless you opened and resaved the file, sometimes dates would just not be parsed for some files.
Major Changes
iterateStreamutility, which was causing stalls and race conditions (Closes [bug] iterate-stream causes race conditions in streaming mode #1558)Minor Changes
Test plan
All of our edge case tests that use exceljs under the hood pass, and the existing exceljs tests pass. Let me know if you would like to see any additional tests.