Skip to content

WCS GetCoverage for very large rasters runs into memory error in MapServer #523

Open
@lubojr

Description

For extremely large products from urban atlas 2012 collection, after sending a large WCS GetCoverage request: for example "wcs_size":" 16309 31633" and 8 bands of data, we probably hit some MapServer value overflow error, as following is logged from renderer:

MapServer: Dispatching.
msSmallCalloc(): Out of memory allocating -3308483712 bytes

note the negative bytes count

The size of raster is definitely too large to be handled by our available memory, but unfortunately no exception is being thrown in this case from the OWS call to Mapserver

status = map_.OWSDispatch(request)

so the user gets just a 500 error as a response without any encoded exception text from mapserver.

If I instead decreased the scale of image requested, an expected exception is thrown reaching the memory limits of the machine:

MapServer: Dispatching.
MapServer: Dispatch took 1.483050 seconds.
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/eoxserver/services/views.py", line 75, in ows
    result = handler.handle(request)
  File "/usr/local/lib/python3.8/dist-packages/eoxserver/services/ows/wcs/basehandlers.py", line 323, in handle
    result_set = renderer.render(params)
  File "/usr/local/lib/python3.8/dist-packages/eoxserver/services/mapserver/wcs/coverage_renderer.py", line 168, in render
    raw_result = ms.dispatch(map_, request)
  File "/usr/local/lib/python3.8/dist-packages/eoxserver/contrib/mapserver.py", line 158, in dispatch
    raise MapServerException(message, locator, code)
eoxserver.contrib.mapserver.MapServerException: msDrawRasterLayerGDAL(): Memory allocation error. Allocating work image of size 9784x18977 failed.

Some investigation:

We use MapServer version 7.4.3 in our latest EOxServer (Ubuntu 20.04 base). I have tried locally to use a Ubuntu 21.10 base image which supports MapServer 7.6.3 release from 4/2021 and the situation was the same, so up to latest stable release, the issue was not fixed. I was not trying a custom built MapServer from current master though.

I think this error needs to be fixed at the source - at MapServer, but would need to be located and fixed.

mapfile_example.txt

Requests used:

https://sso.ua2012.pass.copernicus.eu/ows?service=WCS&version=2.0.1&request=GetCoverage&coverageId=urn%3Aeop%3AEUSI%3AEW02%3A103005000BF8CA00%3A054449393010_ms&SCALEFACTOR=0.3
returns expected exception in msDrawRasterLayerGDAL()
https://sso.ua2012.pass.copernicus.eu/ows?service=WCS&version=2.0.1&request=GetCoverage&coverageId=urn%3Aeop%3AEUSI%3AEW02%3A103005000BF8CA00%3A054449393010_ms&SCALEFACTOR=0.4
falls into memory allocation error somewhere
Leaving out the SCALEFACTOR parameter yield same result as SCALEFACTOR=0.4

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions