[gdal-dev] gdalwarp RCP issues between GDAL 2.1.0 and 2.1.3

Even Rouault even.rouault at spatialys.com
Fri Apr 21 14:23:34 PDT 2017

On vendredi 21 avril 2017 15:58:11 CEST Deschamps, Benjamin (AAFC/AAC) wrote:
> Hi,
> I've run into issues using gdalwarp for an RPC ortho. My input GeoTiff file
> contains the required information in the RPC metadata domain, and the
> command runs fine under the GDAL 2.1.0 command line utility (windows 7,
> 64-bit):
> gdalwarp -multi -tap -et 0.0 -r cubic -srcnodata 0 -rpc -overwrite -to
> "RPC_DEM=D:\Temp\bug_gdalwarp\DEM.tif" -tr 30 30 -t_srs "+proj=aea
> +lat_1=44.75 +lat_2=55.75 +lat_0=40 +lon_0=-96 +x_0=0 +y_0=0 +ellps=WGS84
> +datum=WGS84 +units=m +no_defs" D:\Temp\bug_gdalwarp\IMG.tif
> D:\Temp\bug_gdalwarp\IMG_ortho.tif
> However, the same command and inputs fail under GDAL 2.1.3, without error
> messages, after getting to about 20% on the progress bar. It simply pops up
> the usual window saying "gdalwarp.exe has stopped working. A problem caused
> the program to stop working correctly"...
> Strangely, it only crashes for some images, while some are OK. I haven't
> been able to pinpoint the cause.

There was a race related to the use of -multi and RPC_DEM that can explain the somewhat 
random behaviour.
I've fixed it per https://trac.osgeo.org/gdal/ticket/6869

An easy workaround is to remove -multi that gives only modest performance improvements 
in most situations (especially here when there's no compression in the input or output).
Using -wo NUM_THREADS=ALL_CPUS (which can be combined with -multi in situations where 
-multi works) should be safe in that case even on 2.1.3, and bring much more performance 

I believe (haven't checked though) that even in 2.1.0, and probably earlier versions, if you 
don't get crashes, the race condition still exists and can possibly be silently unnoticed but 
probably produce wrong results. In 2.1.3 some sanity checks in that prevented the crash by 
chance in earlier versions had been removed, hence the crash. So even on 2.1.0 I'd advise not 
using -multi with RPC_DEM


Spatialys - Geospatial professional services
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170421/0d64b868/attachment.html>

More information about the gdal-dev mailing list