Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.OutOfMemoryError: Java heap space when run FF with profile #2999

Closed
emaks opened this issue Oct 24, 2016 · 6 comments
Closed

java.lang.OutOfMemoryError: Java heap space when run FF with profile #2999

emaks opened this issue Oct 24, 2016 · 6 comments

Comments

@emaks
Copy link

emaks commented Oct 24, 2016

Meta -

OS: Win7
Selenium Version: 3.0.1
Browser: Firefox
Browser Version: 47.0.1

Expected Behavior -

Created new instance of webdriver

Actual Behavior -

There is no possibility to run firefox using profile.

java.lang.OutOfMemoryError: Java heap space

at java.util.Arrays.copyOf(Arrays.java:3332)
at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:137)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:121)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:421)
at java.lang.StringBuffer.append(StringBuffer.java:272)
at java.io.StringWriter.write(StringWriter.java:101)
at com.google.gson.stream.JsonWriter.string(JsonWriter.java:561)
at com.google.gson.stream.JsonWriter.value(JsonWriter.java:419)
at com.google.gson.internal.bind.TypeAdapters$25.write(TypeAdapters.java:690)
at com.google.gson.internal.bind.TypeAdapters$25.write(TypeAdapters.java:704)
at com.google.gson.internal.bind.TypeAdapters$25.write(TypeAdapters.java:704)
at com.google.gson.internal.bind.TypeAdapters$25.write(TypeAdapters.java:642)
at com.google.gson.internal.Streams.write(Streams.java:68)
at com.google.gson.Gson.toJson(Gson.java:668)
at com.google.gson.Gson.toJson(Gson.java:634)
at com.google.gson.Gson.toJson(Gson.java:619)
at org.openqa.selenium.remote.BeanToJsonConverter.convert(BeanToJsonConverter.java:67)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:54)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.execute(NewProfileExtensionConnection.java:160)
at org.openqa.selenium.firefox.FirefoxDriver$LazyCommandExecutor.execute(FirefoxDriver.java:467)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:259)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:247)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:242)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:135)
at com.ProfileTest.test(ProfileTest.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

Steps to reproduce -

    DesiredCapabilities cap = DesiredCapabilities.firefox();
    cap.setCapability("marionette", false);
    cap.setCapability("firefox_profile", new ProfilesIni().getProfile("default"));

    FirefoxDriver driver = new FirefoxDriver(cap);
    driver.get("https://www.google.com/");
@emaks emaks changed the title java.lang.OutOfMemoryError: Java heap space. java.lang.OutOfMemoryError: Java heap space when run FF with profile Oct 24, 2016
@lukeis
Copy link
Member

lukeis commented Oct 24, 2016

This is a java problem, not a selenium problem. Configure your JVM settings.

http://stackoverflow.com/questions/37335/how-to-deal-with-java-lang-outofmemoryerror-java-heap-space-error-64mb-heap

@lukeis lukeis closed this as completed Oct 24, 2016
@emaks
Copy link
Author

emaks commented Oct 25, 2016

@lukeis I think problem is not in JVM settings. If I use selenium 2.53.1 - everything works as expected. I tried to run with settings -Xms512m -Xmx512m and got the same error.

@shashankgupta5
Copy link

Able to replicate the issue with following steps-

                DesiredCapabilities capabilities = DesiredCapabilities.firefox();

                ProfilesIni profile = new ProfilesIni();
                FirefoxProfile firefoxProfile = profile
                        .getProfile("default");
                capabilities.setCapability("marionette", false);
                capabilities.setCapability(FirefoxDriver.PROFILE,
                        firefoxProfile);

                driver = new FirefoxDriver(capabilities);

And trace as follows-

FAILED CONFIGURATION: @BeforeTest beforeTest
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:3332)
at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:137)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:121)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:421)
at java.lang.StringBuilder.append(StringBuilder.java:136)
at org.openqa.selenium.remote.ProtocolHandshake.amendOssParamters(ProtocolHandshake.java:183)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:61)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.execute(NewProfileExtensionConnection.java:160)
at org.openqa.selenium.firefox.FirefoxDriver$LazyCommandExecutor.execute(FirefoxDriver.java:467)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:128)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:259)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:247)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:242)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:135)

Environment-
Win: 7
Webdriver:3.0.1
FF:46.0.1

@rkuzsma
Copy link

rkuzsma commented Dec 19, 2016

I reproduced this issue using 3.0.1 trying to run remotely with an 18MB local Firefox profile folder, on Mac OS X.

I specified various heap sizes, such as -Xmx1024m and -Xmx2056m and even -Xmx8192m, but the error persisted.

I fixed my problem by reducing the Firefox profile folder from 18MB to 13MB by deleting all sub-folders inside it and leaving all top-level files. The test now runs even with the default JVM heap settings.

Perhaps the issue is related to some particular sub-folders inside the profile directory itself.

@ouar
Copy link

ouar commented Mar 12, 2018

Hello everyone,

I can not find how to reduce Firefox profile folder

Best regards

@ja8zyjits
Copy link

Any updates yet? How to fix this. Iam getting this error in Chrome too.

@lock lock bot locked and limited conversation to collaborators Aug 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants