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

Out of memory #509

Closed
vicapow opened this issue Oct 12, 2012 · 10 comments
Closed

Out of memory #509

vicapow opened this issue Oct 12, 2012 · 10 comments

Comments

@vicapow
Copy link

vicapow commented Oct 12, 2012

so, this really weird but I can't figure out why this code works fine on my macbook pro but when it runs on an ubuntu server, it just hangs, never finishing. i even tried passing the html directly to jsdom but still no luck (so I dont think I'm getting rate limited or blocked or anything like that.) but other sites work just fine.

var jsdom = require("jsdom");

jsdom.env("http://reddit.com/",["http://code.jquery.com/jquery.js"],
  function (err, window) {
    if(err) throw err
    console.log('done!')
  }
);

any ideas?

@vicapow
Copy link
Author

vicapow commented Oct 12, 2012

sorry for the spam. i'm also noticing this with the "curl" utility. must be on my end..

@vicapow vicapow closed this as completed Oct 12, 2012
@vicapow
Copy link
Author

vicapow commented Oct 12, 2012

lol. I'm sorry for the back and forth. As best I can, I've now determined it is an issue with jsdom. this code produces the following error:

this code:

var jsdom = require("jsdom")
  , fs = require('fs')

var html = fs.readFileSync('reddit.html')
console.log(html.toString())

jsdom.env({
    html : html.toString()
  }
  , [ "http://code.jquery.com/jquery.js" ]
  , function (err, window) {
    if(err) throw err
    console.log('done!')
  }
);

produces the following error:

FATAL ERROR: CALL_AND_RETRY_2 Allocation failed - process out of memory

here is a pastebin of the html:

http://pastebin.com/xtV48LMK

if that doesn't work i can PM you the html file but it was just the result of:

curl -o reddit.html www.reddit.com

@vicapow vicapow reopened this Oct 12, 2012
@bensheldon
Copy link

I'm experiencing something similar. Works fine on my local machine, but when I push to Heroku (max memory 512MB) it runs out of memory. Just noticed it in an update in the last day.

@domenic
Copy link
Member

domenic commented Oct 12, 2012

Fascinating, this appears to be a regression in 0.2.16. Maybe the new CSSStyleDeclaration stuff takes a lot of memory?

@domenic
Copy link
Member

domenic commented Oct 13, 2012

Reduced test-case:

var jsdom = require("jsdom");
var fs = require("fs");

var html = fs.readFileSync("reddit.html");
jsdom.jsdom(html.toString());

@domenic
Copy link
Member

domenic commented Oct 13, 2012

Yeah, sadly this was caused by 871d40a. We'll have to revert that and push out a new version.

@domenic
Copy link
Member

domenic commented Oct 13, 2012

Fixed and released as 0.2.17. Thanks for reporting.

@vicapow
Copy link
Author

vicapow commented Oct 13, 2012

yep! let me know if you need anything else.

@chad3814
Copy link
Contributor

Okay I have cssstyle fixed for memory, passes all tests in jsdom and cssstyle. Going to make sure it runs on Node v.0.4.8 (sure it will) and then will push a new version to npm and open a pull request here.

@domenic
Copy link
Member

domenic commented Oct 13, 2012

@chad3814 yay!!

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