<div dir="ltr"><div>Hello.<br></div><div><br></div><div>If a Linux process with opened
Tiff dataset is forked, it is not possible to read from the dataset
concurrently in these forked processes, because file offsets and other
attributes of the opened Tiff file are shared between those processes.</div><div><br></div><div>One solution would be to serialize calls to GDAL, but this obviously completely destroy multiprocessing.</div><div><br></div><div>Another
solution would be to open the dataset per each process, but this is
also not desirable. An opened Tiff allocates memory for list of tile
or strip offsets and sizes. These metadata can take hundreds of
megabytes for large Tiff files, not to mention opening more of them.
Therefore forking saves a lot of memory as these metadata are shared
with parent process.</div><div><br></div><div>I've made a patch which
optionally close the underlying Tiff file once a dataset is opened. One
can then fork safely, underlying file is lazily opened again in each
subprocess.</div><div><br></div><div>What do you think about this problem and proposed solutions? Is there some more elegant solution?</div><div><br></div><div>Here are two variants of the patch:</div><div><a href="https://github.com/mapycz/gdal/commit/2bc9227ab656ab7587a4fa7f6d9b6cc1e4b761af" target="_blank">https://github.com/mapycz/<wbr>gdal/commit/<wbr>2bc9227ab656ab7587a4fa7f6d9b6c<wbr>c1e4b761af</a></div><div><a href="https://github.com/mapycz/gdal/commit/92823746743966459f3a2b3940e3713bad31733a" target="_blank">https://github.com/mapycz/<wbr>gdal/commit/<wbr>92823746743966459f3a2b3940e371<wbr>3bad31733a</a><br></div><div><br></div><div>Thank you for any help.</div><div><br></div><div>Jiri<br></div><div><br></div></div>