PermGen memory leak in Browser.drive(Closure script) #335

Closed
geb-bot opened this Issue Sep 20, 2014 · 1 comment

Projects

None yet

2 participants

@geb-bot
geb-bot commented Sep 20, 2014

Originally created by Terence Kent.

Overview:
Each call to Browser.driver(Closure script) leaks a small amount of PermGen memory. The leak appears to be caused by creating a new geb.Configuration object every time.

Steps to reproduce:

  1. Create a standard GebConfig.groovy file in the expected place
  2. Run the following code: while(true){ Browser.drive {} }
  3. Attached a debugger and watch the PermGen usage

(I've also attached a tiny program to demonstrate the issue)

Workaround:
The work around is to not use Browser.drive(Closure script) and instead use one of the other other Browser.drive methods that result in a cached Configuration object being used.

Impact:
This bug will prevent long-running applications from relying on Geb for regular tasks, without discovering/working around this issue. This is more difficult than it sounds since the Book of Geb almost exclusively uses examples with Browser.drive(Closure script) and you won't discover the issue after the program has been running for some time.

Possible Solutions:

  1. Cache the configuration, the same way the webdriver is cached. If a concern shows up about supporting changing configs, make the old behavior possible through a system property.
  2. Adjust how the configuration works so the configuration classes created by GebConfig.groovy (or other config file) can be garbage collected. I have to assume this is possible, though I'm still new to groovy.
@geb-bot
geb-bot commented Sep 23, 2014

Resolved

@geb-bot geb-bot added the Bug label Apr 12, 2015
@erdi erdi was assigned by geb-bot Apr 12, 2015
@geb-bot geb-bot added this to the 0.10.0 milestone Apr 12, 2015
@geb-bot geb-bot closed this Apr 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment