apache / apache/maven-surefire
[SUREFIRE-1655] Surefire leaks classloaders when using in-process strategy
- Dominant language
- Java
- Stars
- 461
- Forks
- 588
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 19
Description
**[Stefan Oehme](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=oehme)** opened **[SUREFIRE-1655](https://issues.apache.org/jira/browse/SUREFIRE-1655?redirect=false)** and commented
The test classloader is created [here](https://github.com/apache/maven-surefire/blob/7149edc6f24fa8bff06372e24a177e86d4960d8c/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/InPluginVMSurefireStarter.java#L77), but never closed. As a result, the underlying JARs in that classloader remain open and cannot be deleted. Also, their content can be stale when opened using java.util.ZipFile.
This is a problem when running Maven integration tests using the Embedded3xLauncher. We are developing a Maven extension and want to make sure it works well with surefire/failsafe. This classloader leak means we have to use a forking launcher instead, which slows down our tests considerably.
---
No further details from [SUREFIRE-1655](https://issues.apache.org/jira/browse/SUREFIRE-1655?redirect=false)
Contributor guide
Research direction
Start in maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/InPluginVMSurefireStarter.java at the classloader creation around line 77. Trace the in-process strategy's lifecycle and exercise it through the Embedded3xLauncher scenario described in the issue. Done means the test classloader is closed so its JARs can be deleted and reopened content is not stale.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100