Skip to content

RuntimeException: Time was negative, only if turn costs enabled #991

Closed

Description

@karussell

There is a bug that includes the turn time of 'infinity' (gets converted into negative when adding a bit), and it happens even if we consider turn restrictions in the routing: point=49.034281%2C1.549737&point=49.032909%2C1.560327&point=49.033029%2C1.563374&ch.disable=true&edge_based=true

but not if we import without turn restrictions.

java.lang.RuntimeException: Time was negative -9223372036854376553 for index 0. Please report as bug and include:49.034281,1.549737; 49.032909,1.560327; 49.033029,1.563374()
	at com.graphhopper.routing.template.ViaRoutingTemplate.calcPaths(ViaRoutingTemplate.java:123)
	at com.graphhopper.GraphHopper.calcPaths(GraphHopper.java:1044)
	at com.graphhopper.GraphHopper.route(GraphHopper.java:934)

In TurnWeighting instead of returning the sum, we should check and return infinity like we do in FastestWeighting:

if (turnCosts "too high") return Double.POSITIVE_INFINITY;

But as we do this in calcTurnWeight this shouldn't be necessary in calcMillis.

The real reason seems to be that we wongly handle u-turns in the QueryGraph. Here the start location A is at a way X-Y where u-turns are forbidden:

X----Y => with query at A => X--A--Y

Somehow the 'turn' Y->A to A->X returns restriction==false but "turn time"==infinity

Activity

  1. added this to the 0.9 milestone on Mar 19, 2017
  2. karussell commented on Mar 20, 2017

    @karussell
    MemberAuthor

    This is highly likely related to #393 where we incorrectly passed the prevEdgeId for the reverse case.

  3. karussell commented on Mar 20, 2017

    @karussell
    MemberAuthor

    The order was exactly opposite: we passed the next edge. Now we've fixed this for (bidir.) Path. Will close here if CH performance is not affected. Nice situation where a test case uncovered many more problems, e.g. not just bidirectional path but also the unidirectional version.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions