[gdal-dev] No IDATs written into file

Ari Jolma ari.jolma at gmail.com
Sat Nov 14 13:01:35 PST 2015


This seems very confusing. The source from which I'm clipping is a 
virtual dataset made from PNG's. The failure happens in 
GDALDataset:RasterIO (it returns CE_Failure) but how it gets there seems 
to be because it does not know the real driver type of the simple 
sources. The driver name at the point of failure returns null and 
filename list is also null.

It goes through DatasetRasterIO of several of the the simple sources 
(for example 8) and then on the 9th it calls poDS->RasterIO, which fails.

Hmm,

Ari

On 14.11.2015 18:59, Even Rouault wrote:
> Le samedi 14 novembre 2015 17:46:47, Ari Jolma a écrit :
>> I'm using the Translate function to clip tiles from a larger raster
>> using Perl bindings. I'm clipping into PNG files.
>>
>> This is in a web service environment, i.e., several workers listening to
>> a client.
> Ari,
>
> Are the workers multi-threaded or each in their own process ?
>
> But even in the multi-threaded case, I can't reproduce with the following :
>
> #include "cpl_multiproc.h"
> #include "gdal_utils.h"
> #include "gdal.h"
>
> void copyFunc(void* arg)
> {
>      const char* pszOut = (const char*)arg;
>      GDALDatasetH hSrcDS = GDALOpen("byte.tif", GA_ReadOnly);
>      char* argv[] = { "-of", "PNG", NULL };
>      GDALTranslateOptions* psOptions = GDALTranslateOptionsNew(argv, NULL);
>      GDALClose(GDALTranslate(pszOut, hSrcDS, psOptions, NULL));
>      GDALClose(hSrcDS);
>      GDALTranslateOptionsFree(psOptions);
> }
>
> int main(int argc, char* argv[])
> {
>      CPLJoinableThread *ht1, *ht2;
>      GDALAllRegister();
>      while(1)
>      {
>          ht1 = CPLCreateJoinableThread(copyFunc, "test1.png");
>          ht2 = CPLCreateJoinableThread(copyFunc, "test2.png");
>          CPLJoinThread(ht1);
>          CPLJoinThread(ht2);
>      }
> }
>
> I assume your GDAL is built --with-threads (which is the default) if you use
> it in a multi-threaded context.
>
> Even
>
>> The Translate fails in pngwrite.c, in png_write_end with error
>> "No IDATs written into file".
>>
>> The script works fine when I have only one worker.
>>
>> I have tried writing the file into file system, VSI file system, etc.
>> The error is the same. The output seems to be consistently 33 bytes
>> long, i.e., only the header I guess.
>>
>> I'm using unique file names.
>>
>> Any ideas?
>>
>> Ari
>>
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev



More information about the gdal-dev mailing list