This repository has been archived by the owner. It is now read-only.

Phantomjs Memory Leak Issue #14308

Closed
entrptaher opened this Issue May 24, 2016 · 8 comments

Comments

Projects
None yet
6 participants
@entrptaher

entrptaher commented May 24, 2016

  1. Which version of PhantomJS are you using? Tip: run phantomjs --version.
    2.1.1 (but it doesn't matter, it happens to any version of Phantomjs)

  2. What steps will reproduce the problem?

    1. Use any testing suite, ie. CasperJS to do a Ajax call or any kind of Async steps.
    2. Give it command while it's still running the previous step.
    3. Bam, memory leak.


    Example Leak

  3. Which operating system are you using?
    I tried:

    • Ubuntu 12.04, 14.04, 16.04
    • Windows Xp, Windows 8.1
    • Digitalocean droplets (Ubuntu server 14.04 x64 image).

    All OS were both 32bit and 64 bit.

  4. Did you use binary PhantomJS or did you compile it from source?
    I used Phantomjs from NPM, also built it, also tried older versions etc etc.

  5. Please provide any additional information below.
    This is a general issue that has been talked over and over for past few years and yet no solution was provided.
    Where:

  6. This has been talked over and over, why did you open another issue?
    Well, did any of them solve the issue? Lets solve this issue once and for all.

  7. What can we do?
    For example, just when the leak happens, find out what it was doing, in my example, Let it wait for reply after a Ajax call. The Ajax call can be async, but waiting for the reply should be sync, thus preventing another command to execute while the ajax call is still in process.

    In CasperJS, there is a method called waitFor which can do the following, and the memory doesn't leak, yet. It might leak in someone elses computer.

    casper.waitFor(function check() {
    data = this.evaluate(function() {
        return document.querySelectorAll('html').length > 0;
    });
    return data;
    }, function then() {
    this.capture('yoursitelist.png');
    });

Now, I wonder, what can be done to prevent the memory leak.

@byaka

This comment has been minimized.

byaka commented May 24, 2016

@entrptaher, great work!
Hope this bug will be fixed in future...

@entrptaher

This comment has been minimized.

entrptaher commented May 24, 2016

In the webserver module, if the concurrent number of connections can be adjusted/limited to 1, then maybe all of the steps would be blocked by default.

@jwoertink

This comment has been minimized.

jwoertink commented Oct 11, 2016

I think I'm seeing a memory leak too. I'm using phantomjs version 2.1.1 on ubuntu 14.04. I open the browser, make the request, then close the browser, then find the PID that it was using and kill that, but the process never seems to go away. Within 30 minutes, I have over 100 phantomjs processes running.

This doesn't happen when running on OSX that I'm seeing.

@byaka

This comment has been minimized.

byaka commented Oct 19, 2016

@jwoertink this not look like mem-leak))
try to kill it with kill -9 [pid]

@liuyihan

This comment has been minimized.

liuyihan commented Nov 14, 2016

Also I'm seeing this issue, hope to be fixed in future…I'm using phantomjs version 2.1.1 on ubuntu 14.04. After I make 10000 request, the process hold almost 1GB memory which cannot be released.

@entrptaher

This comment has been minimized.

entrptaher commented Nov 16, 2016

So the development stopped at 2.1.1.
That's sad I guess.

@Xsmael

This comment has been minimized.

Xsmael commented Nov 16, 2016

I'm facing the same, problem! any hope that this issue will get solved ?

Thanks.

@Vitallium

This comment has been minimized.

Collaborator

Vitallium commented Feb 7, 2017

Let's track this in #11390

@Vitallium Vitallium closed this Feb 7, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.