org.jibx.binding.classes.ClassCache uses a static field to store references to the files that are put on the classpath for the binding compiler.
The problem is that this field is never cleaned up. In standalone mode of the compiler this is not a problem as the VM the classes exist in is terminated more or less immediately.
This however changes, if the corresonding binding compile ant task is used. Since the ant VM is a long living process, the aforementioned resource leaks causes all members of the classpath that were given to the ant task to be locked until the VM terminates.
Short example snippet from our build process:
<bind load="true"> <classpath> <pathelement location="$ {build.classes.dir}
" /> <path refid="build.classpath" /> </classpath> <bindingfileset dir="$ {jibx.binding.dir}
"> <include name="*binding.xml" /> </bindingfileset> </bind>
With the above example, at least all jar files that are part of the refered "build.classpath" will be locked after this call.
The current workaround is to call the <bind> task immediately afterwards again, with an empty classpath element. This effectively removes the references to the java.io.File's from ClassCache's member. Garbage collection than takes care of the rest.
In case somebody stumbles across this, here's the aforementioned workaround in a target that you can call after every bind task usage.
<!-- JiBX Binding Compiler task leaks file references. Use this call with an empty classpath to clean up after use of the bind task --> <target name="jibx-fix-fileleaks"> <bind load="false"> <classpath/> <bindingfileset dir="."> <include name="dummy.xml" /> </bindingfileset> </bind> </target>
|