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

Maximum call stack size exceeded on OSX #9

Closed
lettertwo opened this issue Feb 28, 2015 · 4 comments
Closed

Maximum call stack size exceeded on OSX #9

lettertwo opened this issue Feb 28, 2015 · 4 comments
Labels

Comments

@lettertwo
Copy link

I'm using gulp-atom-shell, which is in turn using gulp-vinyl-zip, which depends on yazl. I'm running into the following problem (OSX 10.10.2):

RangeError: Maximum call stack size exceeded
    at new Buffer (buffer.js)
    at Function.Buffer.concat (buffer.js:199:16)
    at Entry.getLocalFileHeader (.../node_modules/.../yazl/index.js:302:17)
    at pumpEntries (.../node_modules/.../yazl/index.js:166:33)
    at Entry.doFileDataPump (.../node_modules/.../yazl/index.js:81:7)
    at pumpEntries (.../node_modules/.../yazl/index.js:168:11)
    at Entry.doFileDataPump (.../node_modules/.../yazl/index.js:81:7)
    at pumpEntries (.../node_modules/.../yazl/index.js:168:11)
    at Entry.doFileDataPump (.../node_modules/.../yazl/index.js:81:7)
    at pumpEntries (.../node_modules/.../yazl/index.js:168:11)

As best I can tell, it seems to be due to recursion in pumpEntries() (by calling entry.doFileDataPump(), which in turn (possibly?) calls pumpEntries(), etc).

Maybe it's caused by a very deeply nested file structure, but I'm not sure. I do know that pushing the call to entry.doFileDataPump() to the next frame seems to work, but it feels a little hacky, since i don't actually know why the recursion is occurring.

Thoughts?

@lettertwo
Copy link
Author

Just some further clarification re:

…pushing the call to entry.doFileDataPump() to the next frame seems to work…

I changed line 168 to the following:

process.nextTick(entry.doFileDataPump);

@thejoshwolfe
Copy link
Owner

It looks like there's a bug where calling addBuffer several hundred times can cause this problem.

thejoshwolfe added a commit that referenced this issue Mar 2, 2015
$ node --stack-size=100 --stack-trace-limit=200 test/zip.js index.js --buffer $(for i in {1..1000}; do echo index.js; done) -o /dev/null
@thejoshwolfe
Copy link
Owner

I was able to cause a problem that matched your stacktrace, and i implemented a fix for it in version 2.1.1. If this did not solve your problem, please reopen this issue.

@lettertwo
Copy link
Author

👍 Thanks for the quick fix!

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

No branches or pull requests

2 participants