Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Out of memory #509

Closed
vicapow opened this Issue · 10 comments

4 participants

@vicapow

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

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

@vicapow vicapow closed this
@vicapow

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
@bensheldon

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
Collaborator

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

@domenic
Collaborator

Reduced test-case:

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

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

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

@domenic
Collaborator

Fixed and released as 0.2.17. Thanks for reporting.

@domenic domenic closed this
@vicapow

yep! let me know if you need anything else.

@chad3814

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
Collaborator

@chad3814 yay!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.