Browser/driver processes remain in Geb 8 after tests despite using CachingDriverFactory.clearCacheAndQuitDriver()
- Dominant language
- Groovy
- Stars
- 1.2k
- Forks
- 235
- PR merge metrics
- No merged PRs in 30d
Description
e2e-test setup: gebish, cucumber, and webdrivermanager
I use e2e tests which contain several hundred scenarios, and there are technical requirements for the test cases that I need a “fresh” browser.
For this scenario I use `CachingDriverFactory.clearCacheAndQuitDriver()`
And there is obviously a different behavior in geb 8.0.0.
I did a random sample with a few selected tests and checked after each scenario how many processes there were for the WebDriver and the browser.
Therfore i use
`ps -A -o pid,rss,comm | grep -i 'Google Chrome' | grep -v grep` for the browser processes
and
`ps -A -o pid,rss,comm | grep -i './cache/selenium' | grep -v grep` for the WebDriver processes
With geb 7: everything runs as expected and after each browser restart there is only one browser and WebDriver process.
With geb 8: every created browser and driver process is still remaing also after calling `CachingDriverFactory.clearCacheAndQuitDriver()` which forces the ci-jobs to terminate in cause of a memory issue
```
ext {
gebVersion = '7.0'
seleniumVersion = '4.34.0'
groovyVersion = '4.0.28'
cucumberVersion = '6.10.4'
cucumberCoreVersion = '7.28.2'
webDriverManagerVersion = '6.3.2'
logbackVersion = '1.5.18'
jacksonCoreVersion = '2.20.0'
}
dependencies {
testImplementation "org.gebish:geb-core:$gebVersion"
testImplementation "org.apache.groovy:groovy-all:$groovyVersion"
testImplementation "io.github.bonigarcia:webdrivermanager:$webDriverManagerVersion"
testImplementation "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
testImplementation "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion"
testImplementation "org.seleniumhq.selenium:selenium-ie-driver:$seleniumVersion"
testImplementation "org.seleniumhq.selenium:selenium-edge-driver:$seleniumVersion"
testImplementation "org.seleniumhq.selenium:selenium-java:$seleniumVersion"
testImplementation group: 'io.cucumber:'cucumber-groovy$cucumberVersion"
testImplementation group: 'io.cucumber:'cucumber-core:$cucumberCoreVersion"
testImplementation group: 'io.cucumber:'cucumber-junit:$cucumberCoreVersion"
testImplementation group: 'ch.qos.logback:'logback-classic:$logbackVersion"
}
```
sample date here:
Gebish 7:
=========
browswer-processes:
```
timestamp;scenario;env;pid;rssMB;command;status
2025-09-25 13:31:57;scenario 1;chromehl;21915;195.2;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;NEW
2025-09-25 13:31:58;scenario 2;chromehl;21915;203.9;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;CURRENT
2025-09-25 13:32:00;scenario 3;chromehl;21948;196.4;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;NEW
2025-09-25 13:32:03;scenario 4;chromehl;21971;200.6;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;NEW
2025-09-25 13:32:06;scenario 5;chromehl;21992;201.2;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;NEW
2025-09-25 13:32:09;scenario 6;chromehl;22018;204.8;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;NEW
2025-09-25 13:32:12;scenario 7;chromehl;22018;210.4;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;CURRENT
2025-09-25 13:32:15;scenario 8;chromehl;22048;204.6;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;NEW
```
driver-processes:
```
timestamp;scenario;pid;rssMB;command;status;
2025-09-25 13:31:57;scenario 1;21914;19.9;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;NEW
2025-09-25 13:31:58;scenario 2;21914;20.3;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;CURRENT
2025-09-25 13:32:00;scenario 3;21947;19.6;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;NEW
2025-09-25 13:32:03;scenario 4;21970;24.8;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;NEW
2025-09-25 13:32:06;scenario 5;21991;24.6;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;NEW
2025-09-25 13:32:09;scenario 6;22017;25.4;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;NEW
2025-09-25 13:32:12;scenario 7;22017;25.4;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;CURRENT
2025-09-25 13:32:15;scenario 8;22047;25.0;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;NEW
```
Gebish 8:
========
browswer-processes:
```
timestamp;scenario;env;pid;rssMB;command;status
2025-09-25 13:39:15;scenario 1;chromehl;22665;195.1;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;NEW
2025-09-25 13:39:17;scenario 2;chromehl;22665;204.0;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;CURRENT
2025-09-25 13:39:19;scenario 3;chromehl;22665;204.7;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;STALE
2025-09-25 13:39:19;scenario 3;chromehl;22703;193.9;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;NEW
2025-09-25 13:39:21;scenario 4;chromehl;22665;190.5;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;STALE
2025-09-25 13:39:21;scenario 4;chromehl;22703;200.3;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;STALE
2025-09-25 13:39:21;scenario 4;chromehl;22728;201.2;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;NEW
2025-09-25 13:39:24;scenario 5;chromehl;22665;178.4;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;STALE
2025-09-25 13:39:24;scenario 5;chromehl;22703;184.4;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;STALE
2025-09-25 13:39:24;scenario 5;chromehl;22728;206.8;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;STALE
2025-09-25 13:39:24;scenario 5;chromehl;22757;201.1;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;NEW
2025-09-25 13:39:27;scenario 6;chromehl;22665;180.2;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;STALE
2025-09-25 13:39:27;scenario 6;chromehl;22703;172.3;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;STALE
2025-09-25 13:39:27;scenario 6;chromehl;22728;189.2;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;STALE
2025-09-25 13:39:27;scenario 6;chromehl;22757;206.3;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;STALE
2025-09-25 13:39:27;scenario 6;chromehl;22777;207.8;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;NEW
2025-09-25 13:39:30;scenario 7;chromehl;22665;180.0;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;STALE
2025-09-25 13:39:30;scenario 7;chromehl;22703;174.6;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;STALE
2025-09-25 13:39:30;scenario 7;chromehl;22728;184.9;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;STALE
2025-09-25 13:39:30;scenario 7;chromehl;22757;204.2;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;STALE
2025-09-25 13:39:30;scenario 7;chromehl;22777;212.8;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;CURRENT
2025-09-25 13:39:34;scenario 8;chromehl;22665;180.6;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;STALE
2025-09-25 13:39:34;scenario 8;chromehl;22703;173.9;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;STALE
2025-09-25 13:39:34;scenario 8;chromehl;22728;178.3;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;STALE
2025-09-25 13:39:34;scenario 8;chromehl;22757;205.2;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;STALE
2025-09-25 13:39:34;scenario 8;chromehl;22777;218.3;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;STALE
2025-09-25 13:39:34;scenario 8;chromehl;22813;204.6;/Applications/Google Chrome.app/Contents/MacOS/Google Chrome;NEW
```
driver-processes:
```
timestamp;scenario;pid;rssMB;command;status;
2025-09-25 13:39:15;scenario 1;22664;19.6;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;NEW
2025-09-25 13:39:17;scenario 2;22664;19.9;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;CURRENT
2025-09-25 13:39:19;scenario 3;22664;19.9;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;STALE
2025-09-25 13:39:19;scenario 3;22702;19.7;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;NEW
2025-09-25 13:39:21;scenario 4;22664;18.2;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;STALE
2025-09-25 13:39:21;scenario 4;22702;19.7;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;STALE
2025-09-25 13:39:21;scenario 4;22723;24.9;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;NEW
2025-09-25 13:39:24;scenario 5;22664;16.1;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;STALE
2025-09-25 13:39:24;scenario 5;22702;17.8;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;STALE
2025-09-25 13:39:24;scenario 5;22723;24.9;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;STALE
2025-09-25 13:39:24;scenario 5;22756;24.9;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;NEW
2025-09-25 13:39:27;scenario 6;22664;16.2;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;STALE
2025-09-25 13:39:27;scenario 6;22702;15.7;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;STALE
2025-09-25 13:39:27;scenario 6;22723;23.8;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;STALE
2025-09-25 13:39:27;scenario 6;22756;24.9;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;STALE
2025-09-25 13:39:27;scenario 6;22776;24.6;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;NEW
2025-09-25 13:39:30;scenario 7;22664;16.2;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;STALE
2025-09-25 13:39:30;scenario 7;22702;15.7;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;STALE
2025-09-25 13:39:30;scenario 7;22723;23.1;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;STALE
2025-09-25 13:39:30;scenario 7;22756;24.9;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;STALE
2025-09-25 13:39:30;scenario 7;22776;24.7;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;NEW
2025-09-25 13:39:34;scenario 8;22664;16.2;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;STALE
2025-09-25 13:39:34;scenario 8;22702;15.7;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;STALE
2025-09-25 13:39:34;scenario 8;22723;21.4;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;STALE
2025-09-25 13:39:34;scenario 8;22756;24.9;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;STALE
2025-09-25 13:39:34;scenario 8;22776;24.7;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;STALE
2025-09-25 13:39:34;scenario 8;22812;24.8;~/.cache/selenium/chromedriver/mac-arm64/140.0.7339.207/chromedriver;NEW
```
Contributor guide
Research direction
Start at CachingDriverFactory.clearCacheAndQuitDriver() and compare its behavior between Geb 7.0 and 8.0. Reproduce the issue with the supplied Selenium, WebDriverManager, Cucumber, Groovy, and Chrome process setup, then verify that each scenario leaves only the expected browser and WebDriver processes and does not cause CI memory exhaustion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy, java
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100