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 #16

Open
brianhiss opened this issue Mar 7, 2013 · 17 comments
Open

Maximum call stack size exceeded #16

brianhiss opened this issue Mar 7, 2013 · 17 comments

Comments

@brianhiss
Copy link

When I try to unzip a file on Heroku, I am getting a Maximum call stack size exceeded if the zip file contains a file of over ~110kb. If all files are less than that, it doesn't seem to matter how big the zip file itself is. Just seems to choke on files inside the zip if larger than ~110kb.

I am using pipe:
fs.createReadStream('test.zip').pipe(unzip.Extract({ path: 'test/' }))

Here is the Heroku crash log:

domain_thrown: true,
POST /config { [RangeError: Maximum call stack size exceeded]
domain:
{ domain: null,
_events: { error: [Function] },
_maxListeners: 10,
members: [ [Object], [Object] ] } }

@timsweb
Copy link
Contributor

timsweb commented Mar 7, 2013

I'm also getting a similar (or the same) error:

node_modules/over/overload.js:18
    var args = Array.prototype.slice.call(arguments);
                                     ^
RangeError: Maximum call stack size exceeded

My zip files are about 5Mb, most work fine (and some 300Mb haven't had any issues), but some don't. I might not be able to link to a failing zip file though as it's contains sensitive information :-(

I did an npm update before posting here so should be on the latest version.

@brianhiss
Copy link
Author

Yeah, I saw your issue. It was closed and a patch issued, but I have cloned the latest code and still no luck.

Not quite sure why it chokes, and it seems to be platform specific issue. On Heroku (less resources) it fails. On my local Mac, it works fine for the big files.

@timsweb
Copy link
Contributor

timsweb commented Mar 7, 2013

I think I know the other issue your talking about, although it's not mine. I too cloned didn't have any joy.

@ralphholzmann
Copy link
Contributor

I'm also experiencing this issue sporadically :/

@timsweb
Copy link
Contributor

timsweb commented Mar 11, 2013

I've had a chance to look into this a little closer and have submitted a pull request (that's opened issue #17). Feel free give it a test.

@brianhiss
Copy link
Author

So far it's working on the use cases it was failing on for me. I will get back if I see anything different. Thank you!

@EvanOxfeld
Copy link
Owner

@timsweb @ralphholzmann @brianhiss Thanks for your help troubleshooting this issue. I wanted to get the fix in #17 up on NPM as soon as possible, so I published v0.1.5.

That said, there's a lot of logic not really about parsing zips in parse.js / untilstream.js that would be more reliable as a module based on the Node 0.10 stream.Transform with its own tests. I'll leave this issue open until the logic's impending move barring problems with the match-stream module. Expect an update to this issue soon. I know some zips that have failed to extract in the past contain sensitive information and would appreciate your help again to test.

@satazor
Copy link

satazor commented Mar 17, 2013

@EvanOxfeld An user complained about this very same issue here: bower/bower#312
I think that's a good test case.

@EvanOxfeld
Copy link
Owner

Really appreciate the test case, @satazor. I'll get it integrated into the unzip tests.

@nprbst
Copy link

nprbst commented Mar 27, 2013

I'm not sure if this is a useful clue or not, but for the same file I can repeatably cause #16 to break or not break by...wait for it...changing from 1 CPU to 2 CPUs!

Configuration

  • Node v0.8.22
  • unzip v0.1.4 (v0.1.5 "hangs" on me)

1 CPU: Breaks every time

  • AWS EC2 Micro Instance, Ubuntu 12.04.1 LTS (~640 MB, 1 CPU)
  • VirtualBox, Ubuntu 12.04.1 LTS (640 MB, 1 CPU)

2 CPUs: Works every time

  • Mac mini Server, OS X Lion (16 GB, 4 cores)
  • VirtualBox, Ubuntu 12.04.1 LTS (640 MB, 2 CPUs)

@satazor
Copy link

satazor commented Apr 3, 2013

@EvanOxfeld Some more details on unzip 0.1.6

node 0.10.3

bootstrap.zip

var unzip = require('unzip');
var fs = require('fs');

fs.createReadStream('bootstrap.zip')
    .pipe(unzip.Extract({ path: 'test' }))
    .on('error', function (err) { console.log('error', err); })
    .on('close', function () { console.log('closed'); });

Works!

jquery-ui-1.10.0.custom.zip

var unzip = require('unzip');
var fs = require('fs');

fs.createReadStream('jquery-ui-1.10.0.custom.zip')
    .pipe(unzip.Extract({ path: 'test' }))
    .on('error', function (err) { console.log('error', err); })
    .on('close', function () { console.log('closed'); });

Fails.. it previously worked. Here's the stack trace:

events.js:72
        throw er; // Unhandled 'error' event
              ^
TypeError: Invalid non-string/buffer chunk
    at chunkInvalid (_stream_readable.js:339:10)
    at readableAddChunk (_stream_readable.js:126:12)
    at Match.Readable.push (_stream_readable.js:113:10)
    at Match.Transform.push (_stream_transform.js:142:32)
    at Match._matchFn (/Users/satazor/Work/twitter/bower/node_modules/unzip/lib/parse.js:161:31)
    at Match._transform (/Users/satazor/Work/twitter/bower/node_modules/unzip/node_modules/match-stream/match.js:39:10)
    at Match.Transform._read (_stream_transform.js:181:10)
    at Match.Transform._write (_stream_transform.js:169:12)
    at doWrite (_stream_writable.js:211:10)
    at writeOrBuffer (_stream_writable.js:201:5)

node 0.8.22

bootstrap.zip

It just hangs while extracting, high CPU usage

jquery-ui-1.10.0.custom.zip

Fails with the same error as the node 0.10.3

@EvanOxfeld
Copy link
Owner

Thanks for the info @satazor - I'm close to a fix, at least for node 0.10.3.

EvanOxfeld pushed a commit that referenced this issue Apr 4, 2013
Recursively calling Parse._flush caused recursive process.nextTick
calls.

Fixes #16.
@satazor
Copy link

satazor commented Apr 7, 2013

@EvanOxfeld after upgrading to 0.1.7, all issues present in my previous comment still exist.
Shall I create a separate issue?

@EvanOxfeld
Copy link
Owner

@satazor If you have a chance, check out #23 - fixes for node 0.10.x, close for node 0.8.x. I'll have more time to devote to fixing this issue later today.

@sindresorhus
Copy link

Is there any updates on this? It's currently a pressing issue for Bower.

@euskadi31
Copy link

I have the same problem

Node: 0.10.12
Bower: 0.10.0
unzip: 0.1.8

@alFReD-NSH
Copy link

Just another sample:

bower downloading http://www.playcraftlabs.com/downloads/playcraft-v0.5.6a.zip
bower extracting /tmp/bower-playcraft-v0.5.6a-2119dtushkw/index.zip

/home/alfred/nvm/v0.10.12/lib/node_modules/bower/node_modules/tmp/lib/tmp.js:260
  throw err;
        ^
TypeError: Invalid non-string/buffer chunk
    at chunkInvalid (_stream_readable.js:365:10)
    at readableAddChunk (_stream_readable.js:137:12)
    at Match.Readable.push (_stream_readable.js:127:10)
    at Match.Transform.push (_stream_transform.js:140:32)
    at Match._matchFn (/home/alfred/nvm/v0.10.12/lib/node_modules/bower/node_modules/unzip/lib/parse.js:161:31)
    at Match._transform (/home/alfred/nvm/v0.10.12/lib/node_modules/bower/node_modules/unzip/node_modules/match-stream/match.js:39:10)
    at Match.Transform._read (_stream_transform.js:179:10)
    at Match.Transform._write (_stream_transform.js:167:12)
    at doWrite (_stream_writable.js:219:10)
    at writeOrBuffer (_stream_writable.js:209:5)
    at Match.Writable.write (_stream_writable.js:180:11)
    at write (_stream_readable.js:573:24)

With the following modules:

bower@0.10.0 /home/alfred/nvm/v0.8.25/lib/node_modules/bower
├── abbrev@1.0.4
├── archy@0.0.2
├── colors@0.6.0-1
├── tmp@0.0.20
├── async@0.2.9
├── mkdirp@0.3.5
├── stable@0.1.3
├── nopt@2.0.0
├── semver@2.0.10
├── which@1.0.5
├── request@2.11.4
├── hogan.js@2.0.0
├── lodash@1.0.1
├── fstream@0.1.23 (inherits@1.0.0, graceful-fs@2.0.0)
├── rimraf@2.0.3 (graceful-fs@1.1.14)
├── tar@0.1.17 (inherits@1.0.0, block-stream@0.0.6)
├── promptly@0.1.0 (read@1.0.5)
├── glob@3.1.21 (inherits@1.0.0, graceful-fs@1.2.3, minimatch@0.2.12)
├── read-package-json@0.1.13 (lru-cache@2.0.4, slide@1.1.4, graceful-fs@1.2.3, semver@1.1.4, npmlog@0.0.4)
├── rc@0.3.0 (deep-extend@0.2.5, ini@1.1.0, optimist@0.3.7)
├── unzip@0.1.7 (setimmediate@1.0.1, readable-stream@1.0.2, pullstream@0.4.0, match-stream@0.0.1, binary@0.3.0)
└── update-notifier@0.1.4 (configstore@0.1.2, request@2.22.0)

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

9 participants