Suggestions on dealing with Memory Leaks in 2.0b3

124 views
Skip to first unread message

Denali Lumma

unread,
Apr 21, 2011, 4:53:18 PM4/21/11
to Selenium Developers
Hi,

We just deployed selenium server 2.0b3 (upgraded from 1.0.3). It
looks like there is some fairly serious memory leaks - OutOfMemory
exception thrown during runs longer than 30 minutes long.

I was hoping to get the 2.0b3 source, apply the assorted patches
submitted thus far and use this. However, when I pull this:

svn checkout http://selenium.googlecode.com/svn/tags/selenium-2.0-beta-3/
selenium-2.0-beta-3

and build with

./go clean release

The resulting binaries don't appear to have the
DefaultSelenium.class. Not sure what is going on here...

Alternately, I thought maybe we will just start working with the
latest release candidate. However, looks like the
DefaultSelenium.class is not here either.

Do I need to upgrade the client code to use WebDriver? I thought
things were suppose to be backwards compatible.

Is there any other known workaround for the memory leaks in the
2.0b3 selenium server?

Suggestions?

Thanks!
-Denali

Kristian Rosenvold

unread,
Apr 22, 2011, 8:09:06 AM4/22/11
to selenium-...@googlegroups.com
There is at least one memory leak that is fixed on trunk ( post b3)

Kristian

> --
> You received this message because you are subscribed to the Google Groups "Selenium Developers" group.
> To post to this group, send email to selenium-...@googlegroups.com.
> To unsubscribe from this group, send email to selenium-develo...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/selenium-developers?hl=en.
>

Patrick Lightbody

unread,
Apr 22, 2011, 11:03:51 AM4/22/11
to selenium-...@googlegroups.com
Do you have more info on this? We're running 2.0b3 in production for browsermob.com and haven't seen any problems so far.

--
Patrick Lightbody
+1 (415) 830-5488

Kristian Rosenvold

unread,
Apr 26, 2011, 6:54:07 AM4/26/11
to selenium-...@googlegroups.com
The memory leak I fixed was related to the logging system
leaking, and I believe you may be running with logging turned
off, which is why you aren't having any troubles.

I fixed it for 2.x clients in
http://code.google.com/p/selenium/source/detail?r=11872

As we know there are some interesting dependencies between
the 2.x server logic and the 1.x server logic, parts of which
caused the resurfacing of the memory leak; so this was fixed - twice ;)

The first time I fixed this bug, I believe I also "observed" this
same leak in the 1.x code, but it was a different code path (alternate
reality?) an I didn't touch it. I was/am a bit short of 1.x test
projects so I haven't really gotten around to fixing it for 1.x .

Kristian

Benjamin Lee

unread,
Apr 26, 2011, 10:07:40 AM4/26/11
to selenium-...@googlegroups.com
Hi Kristian et al.! How are you?

I am a complete newbie here so please excuse any silly assumptions
that I have made... ;-P

I also found that 2.0b2 and 2.0b3 were "leaking" memory in the
logging... so I just wrote a quick hack... not actually knowing the
consequences... ;-P The "leak" would probably not manifest if logging
was turned off.

But I would like to know... what is/are "perThreadTempRecords" used
for? Non-session related log messages?

Regardless, here is the hack... and the server is not leaking
anymore... ;-O


Index: java/server/src/org/openqa/selenium/server/log/PerSessionLogHandler.java
===================================================================
--- java/server/src/org/openqa/selenium/server/log/PerSessionLogHandler.java (revision 12071)
+++ java/server/src/org/openqa/selenium/server/log/PerSessionLogHandler.java (working copy)
@@ -79,6 +79,14 @@
}
records.add(record);
perThreadTempRecords.put(threadId, records);
+ /* XXX. ben. memory appears to *leak* here
+ * just clear()
+ * has the message already been logged? I think so
+ * */
+ if (records.size() > capacity) {
+ records.clear();
+ perThreadTempRecords.put(threadId, records);
+ }
}
}

# watch 'jmap -histo:live 17658 | cut -c6- | sort -n | tail -n20'


On Tuesday, 2011-04-26 at 08:54:07 PM, Kristian Rosenvold scribbled:

*snip*

--
Benjamin Lee mailto:benjam...@realthought.net
Melbourne, Australia http://www.realthought.net
Linux / BSD / GNU tel:+61 4 16 BEN LEE

Open Source "... invest in your world, not a company..."
__________________________________________________________________________
History, n.:
Papa Hegel he say that all we learn from history is that we
learn nothing from history. I know people who can't even learn from
what happened this morning. Hegel must have been taking the long view.
-- Chad C. Mulligan, "The Hipcrime Vocab"

Kristian Rosenvold

unread,
Apr 27, 2011, 11:50:24 AM4/27/11
to selenium-...@googlegroups.com
Is this with 2.x clients or 1.x clients ? 2.x clients have been fixed on
trunk already.


Kristian

Benjamin Lee

unread,
Apr 28, 2011, 6:40:37 AM4/28/11
to selenium-...@googlegroups.com
Hi Kristian!

Yes, 1.x. I was / am using the Ruby client... from gems

selenium-client-1.2.18

I will move to the 2.x client today! ;-)

Thanks again!

On Thursday, 2011-04-28 at 01:50:24 AM, Kristian Rosenvold scribbled:

> --
> You received this message because you are subscribed to the Google Groups "Selenium Developers" group.
> To post to this group, send email to selenium-...@googlegroups.com.
> To unsubscribe from this group, send email to selenium-develo...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/selenium-developers?hl=en.
>

--

Benjamin Lee mailto:benjam...@realthought.net
Melbourne, Australia http://www.realthought.net
Linux / BSD / GNU tel:+61 4 16 BEN LEE

Open Source "... invest in your world, not a company..."
__________________________________________________________________________

Your friends will know you better in the first minute you meet than your
acquaintances will know you in a thousand years.
-- Richard Bach, "Illusions"

Reply all
Reply to author
Forward
0 new messages