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

Big GIFs can cause application crash #11

Open
lorenzos opened this issue Jun 25, 2015 · 5 comments
Open

Big GIFs can cause application crash #11

lorenzos opened this issue Jun 25, 2015 · 5 comments

Comments

@lorenzos
Copy link

I don't know if all big files, or only specific ones, but this:

var mi = require('node-metainspector');
new mi("http://media.giphy.com/media/euBj15T6nrp6g/giphy.gif", {}).fetch();

Crashes the application with:

node_modules/node-metainspector/node_modules/cheerio/lib/parse.js:47
  _.each(dom, function(elem) {
                      ^
RangeError: Maximum call stack size exceeded
    at /home/pi/hangouts-bots/node_modules/node-metainspector/node_modules/cheerio/lib/parse.js:47:23
    at Array.forEach (native)
    at Function._.each._.forEach (/home/pi/hangouts-bots/node_modules/node-metainspector/node_modules/cheerio/node_modules/underscore/underscore.js:78:11)
    at exports.connect (/home/pi/hangouts-bots/node_modules/node-metainspector/node_modules/cheerio/lib/parse.js:47:5)
    at /home/pi/hangouts-bots/node_modules/node-metainspector/node_modules/cheerio/lib/parse.js:64:7
    at Array.forEach (native)
    at Function._.each._.forEach (/home/pi/hangouts-bots/node_modules/node-metainspector/node_modules/cheerio/node_modules/underscore/underscore.js:78:11)
    at exports.connect (/home/pi/hangouts-bots/node_modules/node-metainspector/node_modules/cheerio/lib/parse.js:47:5)
    at /home/pi/hangouts-bots/node_modules/node-metainspector/node_modules/cheerio/lib/parse.js:64:7
    at Array.forEach (native)

If this is hard to solve, I will be glad to know if there is some workaround in order to, at least, keep my application running.

@alexymik
Copy link
Contributor

I had the same issue, seems like it's to do with large requests. I set a request size limit which seems to have fixed the issue for now:

new MetaInspector(param, { limit: 3000000 } );

@19h
Copy link

19h commented Nov 11, 2015

Why would you crawl inspect images? This is for meta information about websites.

@alexymik
Copy link
Contributor

From the project description:

"You give it an URL, and it lets you easily get its title, links, images, description, keywords, meta tags...."

It should not crash when given a URL, even if it's given a URL to an image. The Ruby MetaInspector gem also returns image resolution, so a future feature would be to port that functionality over as well.

@19h
Copy link

19h commented Nov 11, 2015

Here's the source code so PR maybe?

@sshen81
Copy link

sshen81 commented Mar 28, 2016

I've run into similar issues with non-HTML URIs causing errors. Specifically, passing non-HTML body data into the cheerio module can cause call stack exceptions. I've submitted PR #25 to help address this.

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

4 participants