[FWTools] gdal_translate from multiple threads failing

Frank Warmerdam warmerdam at pobox.com
Wed Dec 12 16:36:44 EST 2007


mzorova wrote:
> Running gdal_translate from multiple threads fails with no errors - running
> from a single thread works great.. Any ideas as to why that might be?

MZorova,

gdal_translate is an executable.  Are you "shelling out" to execute it from
multiple threads in some sort of host program? Or do you mean it in the more
generic sense that you are running multiple threads which use various GDAL
API functions to perform translations and it is failing?

A few notes:
  1) In early versions of GDAL 1.4 the GeoTIFF driver's CreateCopy() function
     was putting several hundred kilobytes on the stack and this caused a
     hard to diagnose failure in environments with small stacks - typically
     multi-threaded runtimes such as C# and Java.  I don't think this would
     affect external .exe's running from a thread but I'm not absolutely sure.
     This was fixed in later GDAL releases like GDAL 1.4.4.

  2) GDAL writing is not threadsafe.  You cannot safely have two threads
     active, writing to different files from within the same process space.
     The main issue is around how tiles get pushed out of the tile cache.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the FWTools mailing list