[gdal-dev] Sharing GDAL Dataset objects between threads (JNI)
Even Rouault
even.rouault at mines-paris.org
Mon Oct 14 04:10:13 PDT 2013
Hi Markus,
>
> I am using GDAL (1.10.1) in a Java Servlet environment via JNI. I
> observed that Dataset objects cannot be shared between threads, even if
> they are not used in parallel, but strictly consecutively. For me, the
> VM crashes if a thread uses a Dataset that it didn't create.
>
> So somehow Dataset objects (on the Java or on the C side) seem to be
> using ThreadLocal information.
>
> Is this correct?
This is surprising. Are you seeing that with a particular driver or all drivers
?
I don't see any use of TLS on the Java side. There might be some use of TLS
objects on the C side, for functions in cpl_path.cpp for example, but their use
should be limited to the lifetime of the execution of a particular function, so
that shouldn't cause problems in the scenario you describe.
> Would it be hard to eliminate this behaviour (as it
> would make pooling Dataset objects much easier and more efficient)?
Difficult to tell until we have understood what really happens...
Do you manage to reproduce that by running under Valgrind ? If so, that might
help understanding what is going wrong.
Even
More information about the gdal-dev
mailing list