Giter Site home page Giter Site logo

Comments (14)

inolen avatar inolen commented on May 26, 2024

To note, the corrupt archives all had the same file size, but a hex comparison showed that there were several places in the archive where data had been shifted around. I assumed that chunks of each stream were perhaps being incorrectly interleaved.

from node-archiver.

ctalkington avatar ctalkington commented on May 26, 2024

you may want to listen for the close event of output stream (to do your callback), as finalize doesn't guarantee that your streams have finished dealing with the data sent to them.

from node-archiver.

ctalkington avatar ctalkington commented on May 26, 2024

since archiver can handle being passed files right after each other and then dealing dealing with it internally 1 by 1. you really shouldn't need async at all on that part and there is a nice little helper for lazy loading streams that should ease open file limits.

https://npmjs.org/package/lazystream

from node-archiver.

inolen avatar inolen commented on May 26, 2024

@ctalkington I just had time to look into this finally, and you were 100% correct about waiting for events on the output stream. Thanks!

from node-archiver.

inolen avatar inolen commented on May 26, 2024

Actually, I lied, still hitting some issues. They appear to be the same as #38

from node-archiver.

ctalkington avatar ctalkington commented on May 26, 2024

yah, i really need to get a test environment for Mac so I can see whats going on as I have been unable to reproduce to this point.

from node-archiver.

ctalkington avatar ctalkington commented on May 26, 2024

bit of update from discoveries, this corruption seems to happen more when you are writing multiple zips at once and only when the source is a buffer and goes through zlib.

i messed with this some more, it appears if JUST the line to checksum is removed from the DeflateRawChecksum, it doesn't go crazy and start overwriting itself.

from node-archiver.

ctalkington avatar ctalkington commented on May 26, 2024

also to be noted this corruption also happens randomly and some times its none, one, two, or all the zips that end up corrupt. It almost makes me feel like its a global leak or there is some memory corruption going on from all the buffers being created. yet that doesn't really fit with the DeflateRawChecksum line removal fixing it...

EDIT: after the latest commits the DeflateRawChecksum line removal seems to have been a fluke as its back to erroring. I think its still related to something with buffers.

from node-archiver.

ctalkington avatar ctalkington commented on May 26, 2024

cc @ampgcat

from node-archiver.

ctalkington avatar ctalkington commented on May 26, 2024

during testing, it was found that a higher internal buffer highWaterMark seemed to reduce the occurrence of the issue cropping up. i will be releasing a bugfix in the next day with such a change as a temporary solution.

from node-archiver.

ctalkington avatar ctalkington commented on May 26, 2024

ok, im hoping the latest release eliminates the issue. i spent way too much trying to track down why deflate.pipe was causing such a random race condition so I've moved it back to event listeners for the time being.

from node-archiver.

sokra avatar sokra commented on May 26, 2024

It does fix my issue with corrupt zip files... Thanks ๐Ÿ˜„

from node-archiver.

ctalkington avatar ctalkington commented on May 26, 2024

closing. please open new issue if issue remains.

from node-archiver.

reid avatar reid commented on May 26, 2024

Thank you @ctalkington for researching and fixing this! <3

from node-archiver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.