Thank you, I posted on Jira.
I’ll try to create the test case.
De : Jody Garnett [mailto:jody.garn...@gmail.com]
Envoyé : mardi 22 avril 2014 09:31
À : Stéphane WASSERHARDT
Cc : geotools-gt2-users@lists.sourceforge.net
Objet : Re: [Geotools-gt2-users] Deadlock between ReferencingFactoryFinder and
BufferedCoordinateOperationFactory
Thanks for the report, I have entered into our JIRA issue tracker here:
https://jira.codehaus.org/browse/GEOT-4780
As with many open source projects we are short on volunteers - do you think you
could create a test case or small example of how to reproduce this issue?
Jody Garnett
On Thu, Apr 17, 2014 at 2:14 AM, Stéphane WASSERHARDT
<stephane.wasserha...@magellium.fr<mailto:stephane.wasserha...@magellium.fr>>
wrote:
Hello,
I’m using geotools in a threaded application, where I use the StreamingRenderer
while performing other background process using Geotools.
There’s a recurrent deadlock with some CRS transformations which I will try to
explain with an example :
The StreamingRenderer needs to reproject a raster (Resampler2D.reproject(…)),
it uses the ReferencingFactoryFinder to find the transformation to perform.
More precisely, it goes through ReferencingFactoryFinder.getFactory() which is
synchronized.
When another *simultaneous* process wants to transform an envelope
(ReferencedEnvelope.transform(…)), it ends up searching for the transform using
the BufferedCoordinateOperationFactory.
In the BufferedCoordinateOperationFactory.createOperation(CRS, CRS) method, the
“hints” are locked by a synchronized block.
Then it continues (through the ThreadedHsqlEpsgFactory), and sometimes ends up
with a transform that needs to use the ReferencingFactoryFinder in order to
initialize itself.
For instance, the NTv2Transform uses its “locateGrid” method which uses the
ReferencingFactoryFinder.
But the ReferencingFactoryFinder.getFactory() method cannot be called since
it’s locked by the StreamingRenderer’s thread.
The processing thread is locked, but the one using the StreamingRenderer can
continue (and hopefully finish) its work so that it releases the lock on
ReferencingFactoryFinder.
In the ReferencingFactoryFinder.getFactory() method which is running in this
thread, geotools iterates over all factories, and will find the
BufferedCoordinateOperationFactory.
The BufferedCoordinateOperationFactory.getImplementationHints() method is
called, and waits for its “hints” in a synchronized block…
Here is the deadlock :
* The StreamingRenderer thread owns the lock on ReferencingFactoryFinder, and
waits for the BufferedCoordinateOpertaionFactory’s hints lock to be released.
* The processing thread owns the lock on the
BufferedCoordinateOpertaionFactory’s hints, and waits for the
ReferencingFactoryFinder to be released.
I’m not familiar enough with the referencing and transform API to find where
and how to fix this properly…
Can someone help please ?
Thanks in advance.
Stephane
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net<mailto:GeoTools-GT2-Users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users