peerigon / phridge

A bridge between node and PhantomJS
The Unlicense
519 stars 50 forks source link

Memory exhausted? #52

Closed moshewe closed 8 years ago

moshewe commented 8 years ago

I got the following error:

Memory exhausted.
c:\Exposebox\Source\Spider\node_modules\phridge\lib\Phantom.js:380
        error.message = errorMessage + ": " + error.message;
                      ^

TypeError: Cannot assign to read only property 'message' of 1
    at Phantom._onUnexpectedError (c:\Exposebox\Source\Spider\node_modules\phridge\lib\Phantom.js:380:23)
    at emitTwo (events.js:92:20)
    at ChildProcess.emit (events.js:172:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)

From I can understand, this means that the phantom process exited with status 1?

jhnns commented 8 years ago

Hi. It looks like your either your Node.js or Phantom process takes up too much memory. There's nothing phridge could do about it :)

I'll reopen this issue when you add an example that this is an issue with phridge itself.

zhukevgeniy commented 7 years ago

Hi, @jhnns . I have the same problem I can't resolve. Can u help me, what's wrong with this code?

jhnns commented 7 years ago

Why do you set process.setMaxListeners(Infinity);?

The code looks fine, although you could re-use the phantom process. A single phantomjs process can open multiple pages.

zhukevgeniy commented 7 years ago

Thanx for advise, @jhnns , but how can I solve this issue? I mean memory exhausted.

zhukevgeniy commented 7 years ago

And can I iterate over 3,4k+ urls in one process?

jhnns commented 7 years ago

What kind of answer to you expect from me? I know nothing about your setup.

Besides that, the error is pretty clear: Memory exhausted. There is something that takes up too much memory. Phridge is just a bridge to PhantomJS, your error is not related to Phridge itself (unless you can show me that Phridge is eating up too much memory).

a-bobkov commented 7 years ago

@zhukevgeniy As far as I tried, it's not possible to open 3,4k+ urls in one PhantomJS process. Probably due to some memory leaks in PhantomJS. But you can open many PhantomJS processes consequently, killing the previous process, of course. That way I opened 6K+ urls someday.