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 at Courgette.java:54 #214

Closed
natfatykhova opened this issue Sep 25, 2020 · 20 comments
Closed

java.lang.OutOfMemoryError at Courgette.java:54 #214

natfatykhova opened this issue Sep 25, 2020 · 20 comments

Comments

@natfatykhova
Copy link

Hello,

I'm currently upgrading to version 5.4.0, and I'm getting an error when building report:
`RunGhostTests > courgette.api.junit.Courgette.[some tests] FAILED
courgette.runtime.CourgetteTestFailureException
java.lang.OutOfMemoryError at Courgette.java:54

5 tests completed, 1 failed`

Could you please advice what could be the cause. I'm getting this for new version only, everything works fine when I run same tests on an old branch with version 3. Thanks

@prashant-ramcharan
Copy link
Owner

prashant-ramcharan commented Sep 25, 2020

Hello,

Unfortunately, I cannot reproduce this.

  • How much free memory do you have before you start running the tests?
  • Are you running the tests from the command line using Maven or Gradle or on an IDE like IntelliJ?
  • Does this happen all the time?
  • Can you try increasing the heap size? (e.g by passing JVM option -Xmx1g) more info

@natfatykhova
Copy link
Author

It happens when I run a set of 20+ tests, scenario level.
Same thing locally (IntelliJ, Macbook Pro, 16Gb) and remotely in Jenkins.
I tried with -Dcourgette.vmoptions="-Xms256m -Xmx512m" but same result...

Is there an option to switch off courgette report? I need only cucumber.json for internal use.

@prashant-ramcharan
Copy link
Owner

Do you have a zipped project or git repo I can reproduce this on?

@prashant-ramcharan
Copy link
Owner

Locally, can you also try setting the heap size in your IntelliJ run configuration?

Screenshot 2020-09-25 at 18 18 56

@natfatykhova
Copy link
Author

Thanks a lot for your advice. I tried both feature and scenario level, makes no difference. Unfortunately I can't share this project. It looks like the problem could be in reports being too large on my side... For the last run I've got 7Mb cucumber.json and 28Mb cucumber.html (not sure if it's normal or large?). Let me play with VM Options, hopefully that will help.

@prashant-ramcharan
Copy link
Owner

28mb html report is quite large. I assume you saving a lot of images to the report?

@natfatykhova
Copy link
Author

Hi, just an update on the issue, could be a Cucumber problem: https://github.com/cucumber/cucumber/issues/1232
Looking forward for 6.9.0 update. Thanks!

@prashant-ramcharan
Copy link
Owner

@natfatykhova This update is now released in Courgette version 5.7.0

@natfatykhova
Copy link
Author

Thank you @prashant-ramcharan !
I tried with new version, but it failed again with
RunGhostTests > courgette.api.junit.Courgette.Testcase name FAILED courgette.runtime.CourgetteTestFailureException java.lang.OutOfMemoryError at Courgette.java:53

Current memory setting are org.gradle.jvmargs=-Xms2G -Xmx2G -XX:+HeapDumpOnOutOfMemoryError

I tried again with Courgette off, just direct Cucumber, and it passed without exception... Could it be a memory leak, visible only for large projects?
Thanks.

@prashant-ramcharan
Copy link
Owner

prashant-ramcharan commented Nov 17, 2020

Hi @natfatykhova

How many tests are your running and how big (in size) are your Cucumber reports?

Can you try the following and check if you get the same error?

  1. Try removing the Cucumber reports plugins from your Courgette runner?

  2. Run the Courgette runner directly from your IDE and pass VM options.

-Xms2048m -Xmx4096m

@prashant-ramcharan
Copy link
Owner

prashant-ramcharan commented Nov 17, 2020

@natfatykhova I'm now able to reproduce this.

I will look into resolving this.

@natfatykhova
Copy link
Author

Ok cool, thanks for update.

@prashant-ramcharan
Copy link
Owner

@natfatykhova The out of memory error should be resolved in version 5.8.0

Please let me know if it fixes your issue.

@natfatykhova
Copy link
Author

@prashant-ramcharan Thank you, that's great, I've run regression on a new built, it's all good -- didn't get OOM error.
Quick question, looks like now there's a courgette.runtime.CourgetteTestFailureException added to logs for every failed feature, is it? Don't remember seeing it before.

@prashant-ramcharan
Copy link
Owner

prashant-ramcharan commented Nov 23, 2020

That's great @natfatykhova

It should just print once at the end of the test run if there were failures.

@natfatykhova
Copy link
Author

That's what I'm getting in console output for Jenkins build, for failed features only (fail is expected here):

RunGhostTests > courgette.api.junit.Courgette.Testcase1 FAILED
courgette.runtime.CourgetteTestFailureException
courgette.runtime.CourgetteTestFailureException

RunGhostTests > courgette.api.junit.Courgette.Testcase2 FAILED
courgette.runtime.CourgetteTestFailureException

RunGhostTests > courgette.api.junit.Courgette.Testcase3 FAILED
courgette.runtime.CourgetteTestFailureException
courgette.runtime.CourgetteTestFailureException

RunGhostTests > courgette.api.junit.Courgette.Testcases4 FAILED
courgette.runtime.CourgetteTestFailureException

RunGhostTests > courgette.api.junit.Courgette.Testcase5 FAILED
courgette.runtime.CourgetteTestFailureException
courgette.runtime.CourgetteTestFailureException
courgette.runtime.CourgetteTestFailureException
courgette.runtime.CourgetteTestFailureException
courgette.runtime.CourgetteTestFailureException

RunGhostTests > courgette.api.junit.Courgette.Testcase6 FAILED
courgette.runtime.CourgetteTestFailureException

Task :runGhostTests FAILED
8 actionable tasks: 8 executed

@natfatykhova
Copy link
Author

Seems to be an exception for every failed scenario in feature

@prashant-ramcharan
Copy link
Owner

prashant-ramcharan commented Nov 23, 2020

Ah you using the Junit runner.

Yes, this has always printed the exception when there was a failure. It's a way to notifier JUnit that the test failed.

https://github.com/prashant-ramcharan/courgette-jvm/blob/master/src/main/java/courgette/runtime/junit/CourgetteJUnitRunner.java#L90

This was not changed in version in 5.8.0

@prashant-ramcharan
Copy link
Owner

I think the reason why you didn't see it before was because your tests didn't reach that point because of the OOM error.

@natfatykhova
Copy link
Author

Yeah, that makes sense. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants