[mapserver-users] Java MapScript on Tomcat servlet does not free GeoTIFF file handles

beu beu at live.jp
Wed May 20 03:32:34 PDT 2020


Dear all,

I'm coding Java MapScript program as servlet webapp of Tomcat (on Windows),
using "javamapscript.dll" and "mapscript.jar", to process "mapObj" object
dynamically.
But this program has some problems on file-handles.
Could someone please tell me how to fix them?

This program accepts WMS request (GetMap) and returns "image/png" data.

rough flow of this program:
    get HTTP request body
    create OWSRequest instance
    create mapObj instance with some MapFile
    call msIO_installStdoutToBuffer()
    call mapObj#OWSDispatch()
    call mapObj#draw() and create imageObj instance
    call imageObj#save() and create temporary image file
    set image file data to HTTP response body
    delete the image file
    call imageObj#delete()
    call mapObj#delete()
    call OWSRequest#delete()
    call msIO_resetHandlers()

Problem 1:
Tomcat-process does not free GeoTIFF file-handles per (pooling) thread.
With "Resource Monitor" of Windows, it is confirmed that Tomcat8.exe is
holding file-handles of "foobar.tif".

MapFile:
    MAP
        ...
        LAYER
            TYPE RASTER
            STATUS ON
            DATA "foobar.tif"
        END
    END

Problem 2:
Tomcat-process does not free *.shp, *.shx file-handles sometimes,
when it is running multi-thread'ly (more than about 150 threads).

Problem 3:
When the total number of file-handles held reaches some value,
Tomcat-process can not open more files, and MapScript always raise
UnknownError.


With best regards,


MapServer (MapScript) 7.4.3 (on Windows)
... release-1911-x64-gdal-3-0-0-mapserver-7-4-3 at GISInternals
Tomcat 8.5.51 (on Windows)
JavaSE 8u251 (on Windows)
Windows Server 2016


Beu



--
Sent from: http://osgeo-org.1560.x6.nabble.com/Mapserver-User-f4226646.html


More information about the mapserver-users mailing list