Suspect memory leak in org.openqa.selenium.io.TemporaryFilesystem

127 views
Skip to first unread message

Xiaoming Hu

unread,
Feb 23, 2016, 3:02:23 AM2/23/16
to Selenium Users
I raised an issue via selenium bug tracker. Creating a new topic here to look for more help. Here is the link:

https://github.com/SeleniumHQ/selenium/issues/1679

Thanks in advance.

Xiaoming Hu

unread,
Feb 23, 2016, 3:15:31 AM2/23/16
to Selenium Users

We have a long run environment to playback selenium scripts. The command to start the remote server is as the following.

java -Xdump:java:events=user -jar -Djava.util.logging.config.file=/opt/my/logging.properties /opt/my/selenium-server-standalone-reduced-2.47.1.jar -timeout 3600 -browserTimeout 3600

Find that the real memory consumption of this process keeps growing over time.


The heap dump of the selenium server process shows that the class "java.lang.ApplicationShutdownHooks", loaded by "", occupies 97,222,648 (93.28%) bytes.

And there are large number of org.openqa.selenium.io.TemporaryFilesystem$1 objects (159724 in my case) dominated by class "java.lang.ApplicationShutdownHooks" and keeps growing over time.


dominator_tree


I simply took a look at the source code of class org.openqa.selenium.io.TemporaryFilesystem, only found that shutdownHooks are added and no removeShutdownHook is called.
line 62: Runtime.getRuntime().addShutdownHook(shutdownHook),

And looks like shutdownHooks are only removed when stopping the Jetty server.
...
/**

  • Stops the Jetty server
    */
    public void stop() {
    int numTries = 0;
    Exception shutDownException = null;

    // this may be called by a shutdown hook, or it may be called at any time
    // in case it was called as an ordinary method, try to clean up the shutdown
    // hook
    try {
    if (shutDownHook != null) {
    Runtime.getRuntime().removeShutdownHook(shutDownHook);
    }
    } catch (IllegalStateException ignored) {
    } // thrown if we're shutting down; that's OK
    ...

Can anyone help me out. Thanks!

Krishnan Mahadevan

unread,
Feb 24, 2016, 11:17:32 PM2/24/16
to Selenium Users
Just to close off this thread loop, I thought I would post here as well.

I created a simple demo project which can be used to get past this problem [ wherein over a period of time the number of shutdown hooks added by selenium for cleaning up the temporary file system grows when you have a long running selenium JVM ]


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/601e1986-c7e3-40f5-87b6-9cb497135bb6%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages