[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDFJava #YSM-240143]: Problem using as grib parser in tomcat webapp



Hello Giovanni,

I didn't see anything in your code snippet that looked suspicious, but I did a 
little research to try and find out how to diagnose your problem.  One place 
you could start, using an analytical tool, is the Windows program Process 
Explorer, which is available here:

http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

I used this program to look for a file that I knew was open, and it was able to 
confirm that it was open and gave me a PID for the process holding the file 
open.  However, this may not be exceedingly useful, since the process will 
probably be called something anonymous, like "java" ;)

Next, I found several pertinent discussions on how Java handles file.delete() 
in Windows and in general.  Apparently, there is a known problem, but it is 
fairly old and may not apply to this situation:

http://stackoverflow.com/questions/4179145/release-java-file-lock-in-windows
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4715154

These three discussions give very good suggestions about closing files in Java 
that appear to be locked.  Among the suggestions is making sure that your 
file.delete() call is executed in a finally block, rather than a try block.  
There are also discussions about garbage collection and how system.gc() may be 
helpful:

http://stackoverflow.com/questions/586830/java-keeps-lock-on-files-for-no-apparent-reason
http://stackoverflow.com/questions/11579746/force-java-to-release-all-file-locks-handles-in-java
http://stackoverflow.com/questions/1604935/freeing-java-file-handles

Hopefully, some of the advice on these threads will answer your problem.

Cheers,
  Lansing Madry
  Unidata
  Boulder, Colorado

> Hello,
> 
> it happen in a class that is a Quarz job managed by Spring in a Tomcat web
> app container environment.
> 
> Thanks
> Giovanni
> 
> 
> 
> 2013/3/14 Unidata netCDF Java Support <address@hidden>
> 
> > Hi Giovanni,
> >
> > does it happen in a servlet or web app container environment (Tomcat,
> > jetty...) or you are seeing that also in an isolated context?
> >
> > Cheers!
> >
> > Ticket Details
> > ===================
> > Ticket ID: YSM-240143
> > Department: Support netCDF Java
> > Priority: Normal
> > Status: Open
> >
> >
> 
> 
> --
> Giovanni Congedi
> Via Indipendenza, 164
> Ugento (LE)
> Italy
> Cell: 328 5416044
> 
> 


Ticket Details
===================
Ticket ID: YSM-240143
Department: Support netCDF Java
Priority: Normal
Status: Open