[gdal-dev] Race condition between forked processes with opened Tiff dataset on Linux

Andrew C Aitchison andrew at aitchison.me.uk
Fri Dec 15 23:53:01 PST 2017


On Thu, 14 Dec 2017, Jiri Drbalek wrote:

> Hello.
>
> 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.

> 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.
>
> What do you think about this problem and proposed solutions? Is there some
> more elegant solution?

Can I assume that we are talking about opening for read and not for write ?

For writing, I was taught that multi-process programs should do all file 
writing in a dedicated thread.

-- 
Andrew C. Aitchison					Cambridge, UK
 			andrew at aitchison.me.uk


More information about the gdal-dev mailing list