[FWTools] gdal_translate from multiple threads failing

mzorova mzorova at yahoo.com
Wed Dec 12 17:20:59 EST 2007


Sorry for the vague question.. I am shelling out to execute gdal_translate
from my java code - it works ok with just one java thread running (meaning
only one possible instance of gdal_translate.exe running at any given
time).. 

With multiple java threads - each of which might create a shell to run
gdal_translate simultaneously some of them fail randomly - and I have not
really seen any real failure messages either - sometimes I saw something
about accessing a gcs.csv file (but if that file is read-only access, it
should not matter?)



Frank Warmerdam-2 wrote:
> 
> 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
> 
> _______________________________________________
> FWTools mailing list
> FWTools at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/fwtools
> http://fwtools.maptools.org/
> 
> 

-- 
View this message in context: http://www.nabble.com/gdal_translate-from-multiple-threads-failing-tp14302149p14305251.html
Sent from the FWTools mailing list archive at Nabble.com.



More information about the FWTools mailing list