maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Nord (JIRA)" <>
Subject [jira] (MCHECKSTYLE-207) file handle leak - leading to failed builds
Date Sun, 23 Feb 2014 08:27:59 GMT


James Nord commented on MCHECKSTYLE-207:

Hi Dennis,

It's hard to say when it may happen - with the Sun JDK and URLClassloader it shouldn't happen
- but I was reluctant to just swallow the exception with no logging (which is what some other
areas of the core maven code code)

There is nothing (I guess) stopping someone else's classloader being used that could implement
Closeable pre jdk7 and so it could happen on JDK5+ with a custom classloader implementation.

That said I am not really expecting this message to ever be printed.

> file handle leak - leading to failed builds
> -------------------------------------------
>                 Key: MCHECKSTYLE-207
>                 URL:
>             Project: Maven Checkstyle Plugin
>          Issue Type: Bug
>         Environment: Linux
>            Reporter: James Nord
>         Attachments: MCHECKSTYLE-207_PATCH_V1 (1).txt
> The plugin sets the classpath to load as a URLClassloader populated with all the URLs
to the projects dependencies (jars) and output folders.
> However the URLClassloader is never closed (only available in JDK1.7+) and for a large
multi-module project with a large number of dependencies this leak can seriously add up (which
if gc doesn't kick in at the right moment) will lead to random failures due to
error=24, Too many open files.
> see
> Line 162 where the URLClassloader is created - but never cleaned up.
> The fix is relatively trivial if it is only to be fixed for 1.7+ JVMs (and use reflection
if need to be compatable with < 1.7).
> Otherwise a custom classloader will be needed.

This message was sent by Atlassian JIRA

View raw message