You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WMS Raster Layers should not use CLOSE_CONNECTION=DEFER #3077
Reporter: aboudreault Date: 2009/07/27 - 21:14 Trac URL:http://trac.osgeo.org/mapserver/ticket/3077
By default, the gdal dataset connections are opened in DEFER mode excepted for tileindex. This is perfect for single data files but it can a problem for WMS layers. The image of a wms request is saved in a memory buffer and it cannot really have a "shared connection" because we always have to recall the wms request. Although that people doesn't notice that because most just call a small php/python script or use the CGI directly, we can see the problem when we use a bigger script that draw the map multiple times (like precache3.php). The bug can be easily reproduced by loading a map that contains a WMS layer and drawing the map multiple times (without reloading the map).
we should modify the code to close the gdal dataset connection by default for WMS layers.
Author: dmorissette Date: 2009/07/28 - 05:07
It would be ideal to handle this in msDrawRasterLayerLow() together with a simple if (lp->connectiontype==MS_WMS) in the code that handles the connection_close=defer defaults, but unfortunately the code was modified in ticket #541 to recursively call msDrawLayer() from inside msDrawWMSLayerLow() so that opacity works... and to prevent infinite recursion, msDrawWMSLayerLow() overrides the connectiontype to temporarily set it to MS_SHAPEFILE before calling msDrawLayer()... as a result the function finishes the rendering as if the layer was a regular raster layer.
Here are two options I can think of:
1- Force PROCESSING CLOSE_CONNECTION=NORMAL inside msDrawWMSLayerLow() and reset the value at the end of the function... the simplest, but not the cleanest.
2- Go through a complete cleanup of the handling of WMS layers in the msDrawMap() and msDrawLayer() functions to avoid this recursion problem with WMS layers and allow us to leave the connectiontype untouched... then we could just use a if (lp->connectiontype==MS_WMS) in msDrawRasterLayerLow()... much more work but would leave us with much cleaner code in the end. I've got some ideas on the way we could reorganize things but would need to spend more time in the code to confirm that can work.
Do you still plan to address this rework? If not, I could do the simple solution and test it. I'd like this fixed before 6.0, and I feel responsible since it was my change for DEFER stuff that lead to it.
Ok still actual and there's another use error case.
msDrawMap(): Image handling error. Failed to draw layer named 'ORTHOPHOTOS_2012_25'.
msDrawRasterLayerLow(): Unable to access file. Corrupt, empty or missing file '1125-23.tif' for layer 'ORTHOPHOTOS_2012_25'.
This happen due to the fact that the tif contain the overview and also were tiled like what the documentation recommend.
I understand correctly, then there's no way to handle directly this kind of GeoTiff
@tigerfoot, the commands you have used for preparing the tiff file are all standard. Instead of a bug I would rather think that the error message is correct and there is some trouble with accessing the file like wrong path in the tileindex.
This ticket is about cascaded WMS layers when Mapserver is reading image data from another WMS server so you have a different problem. Best forum to start discussion is mapserver-users mailing list, bug tracker is for bugs.
Activity
mapserver-bot commentedon Apr 3, 2012
Author: sdlime
Date: 2009/07/27 - 21:19
Updating component... Steve
mapserver-bot commentedon Apr 3, 2012
Author: aboudreault
Date: 2009/07/27 - 21:35
In fact, the problem is that the '''memory usage''' never stop to grow until the script ends.
mapserver-bot commentedon Apr 3, 2012
Author: dmorissette
Date: 2009/07/28 - 05:07
It would be ideal to handle this in msDrawRasterLayerLow() together with a simple if (lp->connectiontype==MS_WMS) in the code that handles the connection_close=defer defaults, but unfortunately the code was modified in ticket #541 to recursively call msDrawLayer() from inside msDrawWMSLayerLow() so that opacity works... and to prevent infinite recursion, msDrawWMSLayerLow() overrides the connectiontype to temporarily set it to MS_SHAPEFILE before calling msDrawLayer()... as a result the function finishes the rendering as if the layer was a regular raster layer.
Here are two options I can think of:
1- Force PROCESSING CLOSE_CONNECTION=NORMAL inside msDrawWMSLayerLow() and reset the value at the end of the function... the simplest, but not the cleanest.
2- Go through a complete cleanup of the handling of WMS layers in the msDrawMap() and msDrawLayer() functions to avoid this recursion problem with WMS layers and allow us to leave the connectiontype untouched... then we could just use a if (lp->connectiontype==MS_WMS) in msDrawRasterLayerLow()... much more work but would leave us with much cleaner code in the end. I've got some ideas on the way we could reorganize things but would need to spend more time in the code to confirm that can work.
mapserver-bot commentedon Apr 3, 2012
Author: warmerdam
Date: 2010/07/18 - 05:33
Daniel,
Do you still plan to address this rework? If not, I could do the simple solution and test it. I'd like this fixed before 6.0, and I feel responsible since it was my change for DEFER stuff that lead to it.
tigerfoot commentedon Aug 27, 2014
Ok still actual and there's another use error case.
msDrawMap(): Image handling error. Failed to draw layer named 'ORTHOPHOTOS_2012_25'.
msDrawRasterLayerLow(): Unable to access file. Corrupt, empty or missing file '1125-23.tif' for layer 'ORTHOPHOTOS_2012_25'.
This happen due to the fact that the tif contain the overview and also were tiled like what the documentation recommend.
I understand correctly, then there's no way to handle directly this kind of GeoTiff
gdalinfo 1125-23.tif
Driver: GTiff/GeoTIFF
Files: 1125-23.tif
Size is 17500, 12000
Coordinate System is:
PROJCS["CH1903 / LV03",
GEOGCS["CH1903",
DATUM["CH1903",
SPHEROID["Bessel 1841",6377397.155,299.1528128000008,
AUTHORITY["EPSG","7004"]],
TOWGS84[674.4,15.1,405.3,0,0,0,0],
AUTHORITY["EPSG","6149"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4149"]],
PROJECTION["Hotine_Oblique_Mercator"],
PARAMETER["latitude_of_center",46.95240555555556],
PARAMETER["longitude_of_center",7.439583333333333],
PARAMETER["azimuth",90],
PARAMETER["rectified_grid_angle",90],
PARAMETER["scale_factor",1],
PARAMETER["false_easting",600000],
PARAMETER["false_northing",200000],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AUTHORITY["EPSG","21781"]]
Origin = (576250.000000000000000,227000.000000000000000)
Pixel Size = (0.250000000000000,-0.250000000000000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( 576250.000, 227000.000)
Lower Left ( 576250.000, 224000.000)
Upper Right ( 580625.000, 227000.000)
Lower Right ( 580625.000, 224000.000)
Center ( 578437.500, 225500.000)
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
Overviews: 8750x6000, 4375x3000, 2188x1500, 1094x750, 547x375, 274x188, 137x94, 69x47
Band 2 Block=256x256 Type=Byte, ColorInterp=Green
Overviews: 8750x6000, 4375x3000, 2188x1500, 1094x750, 547x375, 274x188, 137x94, 69x47
Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
Overviews: 8750x6000, 4375x3000, 2188x1500, 1094x750, 547x375, 274x188, 137x94, 69x47
The file was prepared by
gdalwarp -wm 4G -multi -s_srs "EPSG:21781" -t_srs "EPSG:21781" -r average -co "TILED=YES" "$F" "$D"
gdaladdo -r average "$D" 2 4 8 16 32 64 128 256
plus gdaltileindex mpd2012.shp *.tif inside the tif directory.
jratike80 commentedon Oct 29, 2015
@tigerfoot, the commands you have used for preparing the tiff file are all standard. Instead of a bug I would rather think that the error message is correct and there is some trouble with accessing the file like wrong path in the tileindex.
This ticket is about cascaded WMS layers when Mapserver is reading image data from another WMS server so you have a different problem. Best forum to start discussion is mapserver-users mailing list, bug tracker is for bugs.
tigerfoot commentedon Oct 30, 2015
fair, can be closed again
jratike80 commentedon Nov 8, 2023
Got a permission to close 8 years ago, closing now.