GeotiffReader does not close files (too many open files)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

GeotiffReader does not close files (too many open files)

Florent gravin-2
Hi,

I extract one coord value on hundreds of geotiff files.
I use this code

// loop on files

AbstractGridFormat format = GridFormatFinder.findFormat( file );
GridCoverage2DReader reader = format.getReader( file );
GridCoverage2D cov = null;
try {
cov = reader.read(null);
DirectPosition pos = new DirectPosition2D(cov.getCoordinateReferenceSystem(),lat, lon);
double[] val = cov.evaluate(pos, (double[]) null);
return val;
} catch (IOException giveUp) {
throw new RuntimeException(giveUp);
} finally {
reader.dispose();
cov.dispose(true);
}
I have a too many open files issue with those files on tomcat.
I see all .tiff files with the command: ls -la /proc/11826/fd | grep .tif

Seems the inputstream of the reader on dispose() throw an exception on close().

Would you know why it's not clean properly and tiff are not closed ?

Thanks.


--
camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Florent Gravin
0479444492

------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
GeoTools-GT2-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Reply | Threaded
Open this post in threaded view
|

Re: GeotiffReader does not close files (too many open files)

jody.garnett
Please check the issue tracker to see if this issue has been reported yet. We are days away from the 17.0 release and it would be really good if you can a) test if this issue is still happening on 17-RC1 and b) make sure it is reported (and provide a patch if you can sort out a fix).

--
Jody Garnett

On 12 March 2017 at 13:39, Florent Gravin <[hidden email]> wrote:
Hi,

I extract one coord value on hundreds of geotiff files.
I use this code

// loop on files

AbstractGridFormat format = GridFormatFinder.findFormat( file );
GridCoverage2DReader reader = format.getReader( file );
GridCoverage2D cov = null;
try {
cov = reader.read(null);
DirectPosition pos = new DirectPosition2D(cov.getCoordinateReferenceSystem(),lat, lon);
double[] val = cov.evaluate(pos, (double[]) null);
return val;
} catch (IOException giveUp) {
throw new RuntimeException(giveUp);
} finally {
reader.dispose();
cov.dispose(true);
}
I have a too many open files issue with those files on tomcat.
I see all .tiff files with the command: ls -la /proc/11826/fd | grep .tif

Seems the inputstream of the reader on dispose() throw an exception on close().

Would you know why it's not clean properly and tiff are not closed ?

Thanks.


--
camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Florent Gravin
0479444492

------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
GeoTools-GT2-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users