[grid] java.lang.OutOfMemoryError: Java heap space

554 views
Skip to first unread message

Tim Johnston

unread,
Jan 7, 2010, 11:52:49 AM1/7/10
to seleniu...@googlegroups.com
Hi, I am running two instances of selenium grid on a dual core mac
mini. The first instance is configured as "Firefox on OS X" and the
second is configured as "Safari on OS X". Both instances have been
upgraded to use version 2.0a1 of selenium. I upgraded them by deleting
the .jar that shipped in selenium-grid/vendor directory and copying in
selenium-server-standalone-2.0a1.jar. My test cases are written in
Python and they are using the selenium Python driver.

When I run tests though selenium grid to the both of the instances
concurrently, the selenium browsers stop working randomly. I enabled
logging on the instances and they show the following error in both
instances:

03:48:25.433 WARN [13] org.openqa.jetty.http.HttpConnection - POST
/selenium-server/driver/?seleniumStart=true&localFrameAddress=top&seleniumWindowName=&uniqueId=sel_27036&sessionId=a4d225e955e24decbd7a69568a61d623&counterToMakeURsUniqueAndSoStopPageCachingInTheBrowser=1262854103927&sequenceNumber=6425
HTTP/1.1
java.lang.OutOfMemoryError: Java heap space
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethod(Class.java:1935)
at java.io.ObjectStreamClass.getPrivateMethod(ObjectStreamClass.java:1382)
at java.io.ObjectStreamClass.access$1700(ObjectStreamClass.java:52)
at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:438)
at java.security.AccessController.doPrivileged(Native Method)
at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:413)
at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:310)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1106)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:416)
at java.util.logging.LogRecord.writeObject(LogRecord.java:424)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
at org.openqa.selenium.server.log.SessionLogsToFileRepository.flushRecordsToLogFile(SessionLogsToFileRepository.java:109)
at org.openqa.selenium.server.log.PerSessionLogHandler.publish(PerSessionLogHandler.java:72)
at java.util.logging.Logger.log(Logger.java:458)
at java.util.logging.Logger.doLog(Logger.java:480)
at java.util.logging.Logger.logp(Logger.java:596)
at org.apache.commons.logging.impl.Jdk14Logger.log(Jdk14Logger.java:99)

As soon as this warning occurs in the logs, all subsequent Selenium
tests time out.

Any suggestions for fixing this issue? I am starting the grid master
by running the "rake hub:start" command on the linux box.

Tim

Sascha

unread,
Jan 8, 2010, 5:01:49 AM1/8/10
to Selenium Users
In general you need to increase the heap space for the JVM (see there:
http://java.sun.com/javase/6/docs/technotes/tools/windows/java.html,
search for Xmx).

But I do not know about "rake hub:start", therefore I do not know
where to define this there.

Another thing you could do is to observe the memory usage of the JVM.
Does the OutOfMemoryError come immediately (then the JVM definitely
needs more heap space) or comes it after some time running without
problems (then it could also be a memory leak).

Sascha

tim

unread,
Jan 13, 2010, 5:10:43 PM1/13/10
to Selenium Users
Thanks for the suggestion Sascha. I don't really know anything about
rake myself, I'm just using it because it worked in my init script.
Which leads to a couple of questions:

1. Is there anyone out there who knows how to pass a JVM parameter on
the command line through rake? I could not find any complete
documentation that lists all the command line parameters for rake. My
current command line is:

"/usr/bin/rake -f /home/tungle/selenium-grid-1.0.4/Rakefile hub:start
BACKGROUND=true"

2. I originally wanted to use ant (where I know how to set the JVM
parameter in build.xml) but was unable to get ant to launch properly
from an init script in debian linux. How are people launching the
selenium grid master from init scripts in linux? Rake? Ant? Pure Java?

Tim

On Jan 8, 5:01 am, Sascha <saschaschwa...@yahoo.de> wrote:
> In general you need to increase theheapspace for the JVM (see there:http://java.sun.com/javase/6/docs/technotes/tools/windows/java.html,


> search for Xmx).
>
> But I do not know about "rake hub:start", therefore I do not know
> where to define this there.
>
> Another thing you could do is to observe the memory usage of the JVM.
> Does the OutOfMemoryError come immediately (then the JVM definitely

> needs moreheapspace) or comes it after some time running without

Reply all
Reply to author
Forward
0 new messages