[gdal-dev] No IDATs written into file
Even Rouault
even.rouault at spatialys.com
Sat Nov 14 08:59:20 PST 2015
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
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list