Files in tomcat/temp directory

User 276402c609

28-12-2011 14:35:16

We are using JChemBase in our web application. After upgrade to 5.7.0 version we found that on Linux platform the web app randomly crashes with error "too many opened files" (as temporary solution we increased default 1024 value to 8192). When we checked the list of opened files, we found that they are located in tomcat/temp directory with file names like imageio9068025691887445724.tmp and so on. As these files contains images of molecules, we believe that this is somehow ralated to our molecule image servlet and code line: servletoutputstream.write(molecule.toBinFormat("jpeg:w400,h400,Q95,#ffffff,wireframe")). The question - is it possible that method toBinFormat generates these temp files and how to close them (as toBinFormat returns byte[])? 

ChemAxon 9c0afc9aaf

28-12-2011 15:02:59

I have moved the question to the appropriate forum section.


My colleagues will reply soon.


Best regards,


Szilard

ChemAxon 5433b8e56b

10-01-2012 03:25:57

Hi,


sorry for the late answer, it was a bit tricky to track it down, and the obvious solution unfortunatelly did came into my mind very late. Finally I have found this bug report on the Java bug database.


The fix which closes the image output streams properly can be delivered in 5.9 version of Marvin, and exsits in all version above 5.5.


As a possible workaround you can call ImageIO.setUseCache(false) in the startup code of the servlet, this call turns off the default image caching to the disc.


I hope this helps.


Regards,
Istvan