-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GeoTiffRasterSource Thread Safety #206
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, though specs can be improved
vlm/src/test/scala/geotrellis/contrib/vlm/geotiff/GeoTiffRasterSourceSpec.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Along with the comments I want to add, that a couple of times GeoTiffReprojectedRasterSource should be threadsafe
failed with the following error:
java.lang.StackOverflowError
at org.locationtech.proj4j.datum.AxisOrder.toENU(AxisOrder.java:122)
at org.locationtech.proj4j.BasicCoordinateTransform.transform(BasicCoordinateTransform.java:137)
at geotrellis.proj4.Proj4Transform$$anonfun$apply$2.apply(Transform.scala:39)
at geotrellis.proj4.Proj4Transform$$anonfun$apply$2.apply(Transform.scala:36)
at geotrellis.vector.reproject.Reproject$.refine$1(Reproject.scala:88)
at geotrellis.vector.reproject.Reproject$.refine$1(Reproject.scala:97)
... (tons of lines, it is a recursive stack)
at geotrellis.vector.reproject.Reproject$.refine$1(Reproject.scala:97)
...
This actually can be related to locationtech/proj4j#29
If it is so we can workaround it by Transform.synchronized
or by ReprojectRasterExtent.synchronized
It can also happen on the readBounds
line targetRasterExtent.extent.reprojectAsPolygon(backTransform, 0.001)
(i'm pretty sure that that is it):
val sourceExtent = closestTiffOverview.synchronized { targetRasterExtent.extent.reprojectAsPolygon(backTransform, 0.001).envelope }
vlm/src/main/scala/geotrellis/contrib/vlm/geotiff/GeoTiffRasterSource.scala
Show resolved
Hide resolved
vlm/src/main/scala/geotrellis/contrib/vlm/geotiff/GeoTiffReprojectRasterSource.scala
Outdated
Show resolved
Hide resolved
vlm/src/main/scala/geotrellis/contrib/vlm/geotiff/GeoTiffReprojectRasterSource.scala
Outdated
Show resolved
Hide resolved
vlm/src/test/scala/geotrellis/contrib/vlm/geotiff/GeoTiffRasterSourceMultiThreadingSpec.scala
Outdated
Show resolved
Hide resolved
vlm/src/test/scala/geotrellis/contrib/vlm/geotiff/GeoTiffRasterSourceMultiThreadingSpec.scala
Outdated
Show resolved
Hide resolved
vlm/src/test/scala/geotrellis/contrib/vlm/geotiff/GeoTiffRasterSourceMultiThreadingSpec.scala
Outdated
Show resolved
Hide resolved
vlm/src/test/scala/geotrellis/contrib/vlm/geotiff/GeoTiffRasterSourceMultiThreadingSpec.scala
Outdated
Show resolved
Hide resolved
vlm/src/main/scala/geotrellis/contrib/vlm/geotiff/GeoTiffReprojectRasterSource.scala
Outdated
Show resolved
Hide resolved
…sampleRasterSource thread safe and added tests Signed-off-by: Jacob Bouffard <jbouffard@azavea.com>
8f9327f
to
7426932
Compare
7426932
to
7ee2e15
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merging once travis is happy
4e95dc6
to
fc6ed2e
Compare
fc6ed2e
to
86e8a29
Compare
Overview
This PR makes reading from
GeoTiffRasterSource
s thread safe by synchronizing thetiff
objects within these instances. That will ensure that the state of the data doesn't change as it's being accessed by different threads.Checklist
Closes locationtech/geotrellis#2954