2

I usually don't post this kind of questions, but this one is driving me crazy. I am using SeleniumWebDriver to filling a form and submitting it. I did this from my computer and it works perfectly, but when I upload the app to OpenShift I get a StackOverflowError when I submit the form. Here's the stacktrace:

[0m[31m04:29:06,529 ERROR [stderr] (Thread-110) Exception in thread "Thread-110" java.lang.StackOverflowError
[0m[31m04:29:06,542 ERROR [stderr] (Thread-110)     at net.sourceforge.htmlunit.corejs.javascript.regexp.NativeRegExp.emitREBytecode(NativeRegExp.java:1311)
[0m[31m04:29:06,547 ERROR [stderr] (Thread-110)     at net.sourceforge.htmlunit.corejs.javascript.regexp.NativeRegExp.emitREBytecode(NativeRegExp.java:1281)
[0m[31m04:29:06,547 ERROR [stderr] (Thread-110)     at net.sourceforge.htmlunit.corejs.javascript.regexp.NativeRegExp.emitREBytecode(NativeRegExp.java:1286)
[0m[31m04:29:06,548 ERROR [stderr] (Thread-110)     at net.sourceforge.htmlunit.corejs.javascript.regexp.NativeRegExp.emitREBytecode(NativeRegExp.java:1286)
[0m[31m04:29:06,548 ERROR [stderr] (Thread-110)     at net.sourceforge.htmlunit.corejs.javascript.regexp.NativeRegExp.emitREBytecode(NativeRegExp.java:1286)
[0m[31m04:29:06,564 ERROR [stderr] (Thread-110)     at net.sourceforge.htmlunit.corejs.javascript.regexp.NativeRegExp.emitREBytecode(NativeRegExp.java:1286)

(he keeps going for a while but all the lines are the same...)

As you can see from the stacktrace, I am using HtmlUnit WebDriver. I googled this but I didn't find anybody with my exact problem, although it seems that HtmlUnit often gives StackOverflow errors...

Can anyone tell me if this is a bug or if am I missing something? Any help is really appreciated, thanks!

EDIT

Here's my code:

HtmlUnitDriver driver = new HtmlUnitDriver(BrowserVersion.CHROME);
driver.setJavascriptEnabled(true);
driver.get(myUrl);
//Finds the fields of the login form and fills it. Also removes the Remember me checkbox.
    WebElement email = driver.findElement(By.id("email"));
    email.clear(); 
    email.sendKeys(username);

    WebElement rememberMe = driver.findElement(By.name("persistent"));
    if(rememberMe.isSelected())rememberMe.click();

    WebElement pass = driver.findElement(By.id("pass"));
    pass.clear();
    pass.sendKeys(pass);

    //HERE IS WHERE THE ERROR OCCURS:
    pass.submit();

Instead of submit I've also tried to get the input manually from the button and click it like this:

    WebElement button = driver.findElement(By.id("u_0_2"));
    button.click();

but the problem is exactly the same...

Aurasphere
  • 3,841
  • 12
  • 44
  • 71
  • Probably it's a bug. Or you are missing something. It's really hard to tell without the code really. Please add an [SSCCE](http://sscce.org/) to get better help on this. – Erik Pragt Oct 23 '15 at 09:52
  • @ErikPragt Thank you for your reply. I added some code. – Aurasphere Oct 23 '15 at 10:00
  • 1
    What is the URL used? – Ahmed Ashour Oct 23 '15 at 10:09
  • @Aurasphere are you doing something which requires fb login? Could be the issue – João Gonçalves Oct 23 '15 at 10:32
  • I'd also try to change the BrowserVersion. I can't find anything wrong with the code – João Gonçalves Oct 23 '15 at 10:49
  • @JoãoGonçalves thanks for your suggestion. I tryed to change the BrowserVersion to FIREFOX_38 but the error is still the same, so I'm guessing it doesn't depend on the platform I'm running... – Aurasphere Oct 23 '15 at 13:19
  • What version do you use? With latest WebDriver (with HtmlUnit 2.19-snapshot), no error using my facebook credentials. – Ahmed Ashour Oct 23 '15 at 13:43
  • @AhmedAshour I'm using Selenium 2.48.2. The fact is that I don't have any problem as well if I run the app in local on my pc. But as soon as it's on openshift server it throws me that exception. Also, I tryed with a little workaround: I've started the driver with javascript disabled and I've been able to submit the form. Then I enabled it and refreshed the page (I need javascript enabled) and as soon as I run this line: List elements = driver.findElements(By.className(className)); I got again the same exception... – Aurasphere Oct 23 '15 at 13:50
  • @Aurasphere My other thought is the necessary resources required for this, maybe a small gear isn't enough? you can check https://blog.openshift.com/measuring-application-performance-with-the-openshift-metrics-cartridge/ – João Gonçalves Oct 23 '15 at 14:06
  • @JoãoGonçalves I read the article but I couldn't find the metrics cartridge. Looking on Google I think that's not available anymore. So that's what I tryed: I deleted the app and recreated it. This time I made it scalable and allocated 2 small gears which means double the resources (exacty 1 GB RAM, 2x CPU) but nothing has changed... I still have the same exception and no clue about what's the problem... Thank you anyway. It was a good suggestion and I didn't think of that myself... – Aurasphere Oct 24 '15 at 23:24
  • @JoãoGonçalves actually you were right. It was a resource problem. I've fixed it putting -Xss4m in my JAVA_OPTS file. If you post an actual answer below I will accept it and award you the bounty.Thank you! – Aurasphere Oct 28 '15 at 10:36
  • @Aurasphere I've posted an answer, feel free to suggest any edits to it – João Gonçalves Oct 28 '15 at 12:40

1 Answers1

3

Small gears have 512MB RAM and 1GB disk space each, so running such "resource intensive" applications might not be always possible and you might consider an upgrade to medium or large gear.

Also, trying to increase the stack size might be an option, see: How to increase the Java stack size?

You can check the Openshift Marketplace for monitoring cartridges.

Community
  • 1
  • 1
João Gonçalves
  • 3,903
  • 2
  • 22
  • 36