This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: leak in gnu.bytecode.ZipLoader


so, the problem here is that ZipLoader holds the archive open until it
has read all of the classes from the archive, but in some(?) cases not
all of the classes are actually read, so the archive remains open
indefinitely.  On windows platforms, the problem manifests as
described below. The problem is more subtle on unix platforms: when
the file is recompiled, there is no error, but subsequent loads refer
to the previously opened zip archive.

two possible workarounds: 
(1) let loadCompiled (in kawa/standard/load.java) explicitly close the
archive. Not clear that this is correct, as I haven't discerned the
cases where the classloader will need subsequent access to the archive.
(2) let ZipLoader read/define all of the classes from the archive on
first access, store them in loadedClasses, and close the archive.

(this problem occurs with the latest CVS version of kawa, but appears
to be a holdover from earlier versions as well)


 > 
 > There appears to be a leak in gnu.bytecode.ZipLoader. I'm getting
 > errors (stacktace below) when recompiling/loading certain files.
 > Evidently there are execution paths through ZipLoader that leave the
 > zip archive open. (an indirect way to verify this is that delete-file 
 > on the zip archive fails, returns #f). This behavior is consistent
 > across 3 different JVMs. 
 > 
 > Still searching for evidence of why this happens. there is some
 > peculiar nondeterminism at play here, as it can take several 
 > compile/load cycles for this error to occur.
 > 
 > 
 > java.lang.InternalError: jzentry == 0
 > 	at java.util.zip.ZipFile$2.nextElement(ZipFile.java:297)
 > 	at gnu.bytecode.ZipLoader.<init>(ZipLoader.java:29)
 > 	at kawa.standard.load.loadCompiled(load.java:62)
 > 	at kawa.standard.load.apply(load.java:168)
 > 	at kawa.standard.load.apply2(load.java:149)
 > 	at kawa.standard.load.apply1(load.java:140)
 > 	at atInteractiveLevel.cl(Unknown Source)
 > 	at atInteractiveLevel.apply1(Unknown Source)
 > 	at gnu.expr.ModuleBody.applyN(ModuleBody.java:95)
 > 	at gnu.expr.ModuleMethod.applyN(ModuleMethod.java:61)
 > 	at gnu.expr.ApplyExp.eval(ApplyExp.java:44)
 > 	at gnu.expr.ModuleExp.evalModule(ModuleExp.java:157)
 > 	at kawa.Shell.run(Shell.java:86)
 > 	at kawa.Shell.run(Shell.java:35)
 > 	at Kawa$SocketRepl.apply0(Kawa.java:44)
 > 	at gnu.mapping.Future.run(Future.java:5)9
 > 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]