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

program hangs while calling geodesicDistanceOnWGS84 #75

Closed
manasdebashiskar opened this Issue Jan 31, 2015 · 12 comments

Comments

Projects
None yet
6 participants
@manasdebashiskar

manasdebashiskar commented Jan 31, 2015

Hi Experts,
I have a classification program in spark that uses ESRI Geometry library. However my spark program hangs at this stage. Looking at stack dump it seems there is a set of points for which geodesicDistanceOnWGS84 hangs.

Is there such a pair of points for which I am expected to see such behavior?

Stack dump

java.lang.StrictMath.atan2(Native Method)
java.lang.Math.atan2(Math.java:499)
com.esri.core.geometry.GeoDist.geodesic_distance_ngs(GeoDist.java:388)
com.esri.core.geometry.SpatialReferenceImpl.geodesicDistanceOnWGS84Impl(SpatialReferenceImpl.java:233)
com.esri.core.geometry.GeometryEngine.geodesicDistanceOnWGS84(GeometryEngine.java:901)
@stolstov

This comment has been minimized.

Member

stolstov commented Feb 2, 2015

@manasdebashiskar I am not aware of such behavior. Do you have a repro case to debug?

@climbage

This comment has been minimized.

Member

climbage commented Feb 2, 2015

I just ran a test in Spark using the above GeometryEngine.geodesicDistanceOnWGS84 method and could not get it to hang. It seems strange that it's happening in native Java code. What operating system are you using? Java Version?

@manasdebashiskar

This comment has been minimized.

manasdebashiskar commented Feb 7, 2015

Hi @climbage . Sorry for the delayed response.
My java version is Oracle JDK 7.45. Centos 6.6
This behaviour of hanging only happens for certain value of geometry Point.
My work around was to print the Point before calling geodesicDistanceOnWGS84 function.
The value of Point that hangs geodesicDistanceOnWGS84 causes printing of the same to crash.
I catch the exception and don't call geodesicDistanceOnWGS84 for those odd Point values.

What I have not been able to figure out is in which case I end up creating a Point that manifests this behaviour.

@climbage

This comment has been minimized.

Member

climbage commented Feb 7, 2015

Interesting... It seems like there is an issue with a double value in your point. I'm not sure how that's even possible.

Do you have the stack trace for when it crashes on print? Also, what is the name of the exception it throw?

@randallwhitman

This comment has been minimized.

Contributor

randallwhitman commented Feb 9, 2015

Another thing you could try is, what happens if you call getX and getY rather than toString (which I assume is being called to print the point)?

@movermeyer

This comment has been minimized.

movermeyer commented Dec 21, 2015

I have what I believe is a reproducible test case in #100.

When trying to compute the distance between a pair of points (using geometry-api-java, 1.2.1), this pair of points seems to hang the library. Here is the code I used (Scala 2.10.5):

import com.esri.core.geometry.{GeometryEngine, Point, SpatialReference}

object testDistanceFailure {
  val p1 = new Point(-60.668485,-31.996013333333334)
  val p2 = new Point(119.13731666666666,32.251583333333336)
  GeometryEngine.geodesicDistanceOnWGS84(p1,p2)
}
  • Centos 6.7
    • Linux 2.6.32-573.7.1.el6.x86_64
  • Scala 2.10.5
  • java version "1.7.0_91"
    • OpenJDK Runtime Environment (rhel-2.6.2.2.el6_7-x86_64 u91-b00)
    • OpenJDK 64-Bit Server VM (build 24.91-b01, mixed mode)
@alocke

This comment has been minimized.

Member

alocke commented Dec 21, 2015

I can reproduce this on Windows using native Java code. We will get this fixed. Thanks!

@alocke alocke added bug and removed cannot reproduce labels Dec 21, 2015

@movermeyer

This comment has been minimized.

movermeyer commented Dec 21, 2015

Here are some other examples of pairs of points:

  • (121.27343833333333, 27.467438333333334) and (-58.55804833333333, -27.035613333333334)
  • (-53.329865, -36.08110166666667) and (126.52895166666667, 35.97385)
  • (-4.7181166667, 36.1160166667) and (175.248925, -35.7606716667)

Notice that the absolute value of the x values sum to near 180, and the y values are nearly * -1 of each other.

IDK if you needed more examples or not.

@alocke

This comment has been minimized.

Member

alocke commented Dec 21, 2015

Good observation. I will add these cases to my test suite.

@stolstov

This comment has been minimized.

Member

stolstov commented Dec 21, 2015

@daburrows The issue is in the GeoDist.java. It has bad termination condition.

                if (PE_ABS(sin_azeq - prev) < tol) {
                    q_continue_looping = false;
                    continue;
                }

The sin_azeq-prev is stuck around 2e-14, while tol is 1e-14.

@movermeyer

This comment has been minimized.

movermeyer commented Dec 22, 2015

Is there any estimate for how long this will take to fix?

I've got a workaround (for my use case) that simply doesn't attempt to call your code if the difference in longitudes is too great.

Obviously, this means that I'm unable to do 100% of the computations, but thankfully my use case is OK with some data loss.

@stolstov stolstov added this to the 1.2.2 milestone Jan 6, 2016

@stolstov

This comment has been minimized.

Member

stolstov commented Jan 7, 2016

fixed

@stolstov stolstov closed this Jan 7, 2016

@randallwhitman randallwhitman modified the milestones: 2.0.0, 1.2.2 Aug 11, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment