opentripplanner / OpenTripPlanner

An open source multi-modal trip planner
http://www.opentripplanner.org
Other
2.21k stars 1.03k forks source link

BICYCLE transfer requests cause OTP to shut down with an error #6210

Closed VillePihlava closed 10 hours ago

VillePihlava commented 2 days ago

I was working on transfer request filtering and something that worked previously started causing OTP to stop from an error. I suspect PR https://github.com/opentripplanner/OpenTripPlanner/pull/6179 might have broken something, because this still worked recently.

Edit: I forgot to build between checking out dev-2.x and I now edited in the proper error with the correct branch built

Expected behavior

OTP should start when the BICYCLE mode is included in transferCacheRequests.

Observed behavior

An error causes dev-2.x OTP to stop when trying to pre-calculate transfer requests for the BICYCLE mode. When I remove the BICYCLE mode transfer requests from the config OTP starts.

Error:

10:56:45.588 INFO [main]  (RaptorRequestTransferCache.java:44) Initializing cache with request: StreetRelevantOptions{transferMode: WALK, walk: WalkPreferences{speed: 1.67, reluctance: 1.8, boardCost: $120, stairsReluctance: 1.65, stairsTimeFactor: 2.0}, street: StreetPreferences{routingTimeout: 9s, elevator: ElevatorPreferences{boardTime: 1m}, accessEgress: AccessEgressPreferences{maxDuration: DurationForStreetMode{default:1h, BIKE:3h, CAR:3h, CAR_TO_PARK:2h}}, maxDirectDuration: DurationForStreetMode{default:4d4h, WALK:1h30m}}}
10:56:45.589 INFO [main]  (ConstructApplication.java:242) Creating initial raptor transfer cache progress: 3 of 6 (50%)
10:56:45.611 ERROR [main]  (OTPMain.java:61) An uncaught error occurred inside OTP: Expected only a single state returned from edge StreetEdge(path, {osm:node:2574652127 lat,lng=60.236859200000005,24.853444000000003} -> {osm:node:3712542205 lat,lng=60.2368834,24.853942800000002}, length=28.422, carSpeed=11.2, permission=PEDESTRIAN_AND_BICYCLE) but received 2
java.lang.IllegalStateException: Expected only a single state returned from edge StreetEdge(path, {osm:node:2574652127 lat,lng=60.236859200000005,24.853444000000003} -> {osm:node:3712542205 lat,lng=60.2368834,24.853942800000002}, length=28.422, carSpeed=11.2, permission=PEDESTRIAN_AND_BICYCLE) but received 2
        at org.opentripplanner.street.search.state.EdgeTraverser.traverseEdges(EdgeTraverser.java:23)
        at org.opentripplanner.routing.algorithm.raptoradapter.transit.Transfer.asRaptorTransfer(Transfer.java:90)
        at org.opentripplanner.routing.algorithm.raptoradapter.transit.RaptorTransferIndex.lambda$create$2(RaptorTransferIndex.java:44)
        at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
        at java.base/java.util.AbstractList$RandomAccessSpliterator.forEachRemaining(AbstractList.java:722)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
        at org.opentripplanner.routing.algorithm.raptoradapter.transit.RaptorTransferIndex.create(RaptorTransferIndex.java:45)
        at org.opentripplanner.routing.algorithm.raptoradapter.transit.request.RaptorRequestTransferCache.put(RaptorRequestTransferCache.java:39)
        at org.opentripplanner.routing.algorithm.raptoradapter.transit.TransitLayer.initTransferCacheForRequest(TransitLayer.java:153)
        at org.opentripplanner.standalone.configure.ConstructApplication.lambda$initializeTransferCache$1(ConstructApplication.java:239)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
        at org.opentripplanner.standalone.configure.ConstructApplication.initializeTransferCache(ConstructApplication.java:238)
        at org.opentripplanner.standalone.configure.ConstructApplication.setupTransitRoutingServer(ConstructApplication.java:172)
        at org.opentripplanner.standalone.configure.ConstructApplication.createApplication(ConstructApplication.java:151)
        at org.opentripplanner.standalone.configure.ConstructApplication.createGrizzlyServer(ConstructApplication.java:114)
        at org.opentripplanner.standalone.OTPMain.startOtpWebServer(OTPMain.java:206)
        at org.opentripplanner.standalone.OTPMain.startOTPServer(OTPMain.java:173)
        at org.opentripplanner.standalone.OTPMain.main(OTPMain.java:56)
10:56:45.613 INFO [server-shutdown-info]  (OtpStartupInfo.java:43) OTP SHUTTING DOWN (version: 2.7.0-SNAPSHOT, ser.ver.id: 168, commit: 53a2132fe4d6e50778d8fe46d27b6978eb189a73, branch: dev-2.x)

Version of OTP used (exact commit hash or JAR name)

commit 53a2132fe4d6e50778d8fe46d27b6978eb189a73

Data sets in use (links to GTFS and OSM PBF files)

HSL data for most of Finland.

Command line used to start OTP

graph build

java -jar -Xmx20G application/target/otp-2.7.0-SNAPSHOT-shaded.jar --build --save ./graphs/finland/

OTP start

java -Xmx16G -jar application/target/otp-2.7.0-SNAPSHOT-shaded.jar --load ./graphs/finland/ --serve --port 9080

Router config and graph build config JSON

build-config.json

{
  "dataImportReport": true,
  "areaVisibility": true,
  "staticParkAndRide": false,
  "subwayAccessTime": 0,
  "maxAreaNodes": 50,
  "maxTransferDuration": "1h",
  "maxStopToShapeSnapDistance": 300,
  "transitServiceStart": "-P2W",
  "transitServiceEnd": "P12W",
  "transitModelTimeZone": "Europe/Helsinki",
  "fares": "hsl",
  "transferRequests": [
    { "modes": "WALK" },
    { "modes": "BICYCLE" },
    { "modes": "CAR" },
    {
      "modes": "WALK",
      "wheelchairAccessibility": {
        "enabled": true
      }
    }
  ],
  "boardingLocationTags": ["ref", "ref:findt", "ref:findr"],
  "osmDefaults": {
    "timeZone": "Europe/Helsinki",
    "osmTagMapping": "finland"
  },
  "emissions": {
    "carAvgCo2PerKm": 170,
    "carAvgOccupancy": 1.3
  }
}

router-config.json

{
  "routingDefaults": {
    "searchWindow": "3h",
    "transferSlack": "1m30s",
    "waitReluctance": 0.99,
    "elevatorBoardTime": 60,
    "bicycle": {
      "boardCost": 120,
      "reluctance": 1.7,
      "optimization": "safest-streets"
    },
    "car": {
      "reluctance": 10.0
    },
    "walk": {
      "speed": 1.3,
      "reluctance": 1.75,
      "stairsReluctance": 1.65,
      "stairsTimeFactor": 2,
      "boardCost": 120
    },
    "accessEgress": {
      "maxDuration": "1h",
      "maxDurationForMode": {
        "CAR_TO_PARK": "2h",
        "BIKE": "3h",
        "CAR": "3h"
      }
    },
    "maxDirectStreetDuration": "100h",
    "maxDirectStreetDurationForMode": {
      "walk": "90m"
    },
    "maxJourneyDuration": "24h",
    "streetRoutingTimeout": "9s",
    "wheelchairAccessibility": {
      "stop": {
        "onlyConsiderAccessible": false,
        "unknownCost": 0,
        "inaccessibleCost": 100000
      },
      "maxSlope": 0.125
    },
    "itineraryFilters": {
      "transitGeneralizedCostLimit": {
        "costLimitFunction": "600 + 1.5x"
      },
      "nonTransitGeneralizedCostLimit": "400 + 1.5x"
    },
    "boardSlackForMode": {
      "AIRPLANE": "2700s"
    },
    "alightSlackForMode": {
      "AIRPLANE": "1200s"
    }
  },
  "transit": {
    "pagingSearchWindowAdjustments": ["8h", "4h", "4h", "4h", "4h"],
    "dynamicSearchWindow" : {
      "maxWindow" : "24h"
    },
    "transferCacheRequests": [
      {
        "modes": "WALK",
        "walk": {
          "speed": 1.2,
          "reluctance": 1.8
        }
      },
      {
        "modes": "WALK",
        "walk": {
          "speed": 1.2,
          "reluctance": 1.8
        },
        "wheelchairAccessibility": {
          "enabled": true
        }
      },
      {
        "modes": "WALK",
        "walk": {
          "speed": 1.67,
          "reluctance": 1.8
        }
      },
      {
        "modes": "BICYCLE",
        "walk": {
          "speed": 1.2,
          "reluctance": 1.8
        },
        "bicycle": {
          "speed": 5.55,
          "rental": {
            "useAvailabilityInformation": true
          },
          "optimization": "SAFEST_STREETS"
        }
      },
      {
        "modes": "BICYCLE",
        "walk": {
          "speed": 1.67,
          "reluctance": 1.8
        },
        "bicycle": {
          "speed": 5.55,
          "rental": {
            "useAvailabilityInformation": true
          },
          "optimization": "SAFEST_STREETS"
        }
      },
      {
        "modes": "CAR",
        "walk": {
          "speed": 1.3,
          "reluctance": 1.75
        }
      }
    ]
  },
  "vectorTiles": {
    "layers": [
      {
        "name": "stops",
        "type": "Stop",
        "mapper": "Digitransit",
        "maxZoom": 20,
        "minZoom": 5,
        "cacheMaxSeconds": 43200
      },
      {
        "name": "realtimeStops",
        "type": "Stop",
        "mapper": "DigitransitRealtime",
        "maxZoom": 20,
        "minZoom": 5,
        "cacheMaxSeconds": 60
      },
      {
        "name": "stations",
        "type": "Station",
        "mapper": "Digitransit",
        "maxZoom": 20,
        "minZoom": 5,
        "cacheMaxSeconds": 43200
      },
      {
        "name": "rentalStations",
        "type": "VehicleRentalStation",
        "mapper": "Digitransit",
        "maxZoom": 20,
        "minZoom": 5,
        "cacheMaxSeconds": 43200,
        "expansionFactor": 0.25
      },
      {
        "name": "realtimeRentalStations",
        "type": "VehicleRentalStation",
        "mapper": "DigitransitRealtime",
        "maxZoom": 20,
        "minZoom": 5,
        "cacheMaxSeconds": 45,
        "expansionFactor": 0.25
      },
      {
        "name": "rentalVehicles",
        "type": "VehicleRentalVehicle",
        "mapper": "Digitransit",
        "maxZoom": 20,
        "minZoom": 5,
        "cacheMaxSeconds": 45,
        "expansionFactor": 0.25
      },  
      {
        "name": "realtimeRentalVehicles",
        "type": "VehicleRentalVehicle",
        "mapper": "DigitransitRealtime",
        "maxZoom": 20,
        "minZoom": 5,
        "cacheMaxSeconds": 45,
        "expansionFactor": 0.25
      },
      {
        "name": "vehicleParking",
        "type": "VehicleParking",
        "mapper": "Digitransit",
        "maxZoom": 20,
        "minZoom": 5,
        "cacheMaxSeconds": 43200,
        "expansionFactor": 0.25
      },
      {
        "name": "vehicleParkingGroups",
        "type": "VehicleParkingGroup",
        "mapper": "Digitransit",
        "maxZoom": 20,
        "minZoom": 5,
        "cacheMaxSeconds": 43200,
        "expansionFactor": 0.25
      }
    ]
  }
}

Steps to reproduce the problem

  1. Checkout up-to-date dev-2.x.
  2. Build graph
  3. Use BICYCLE mode in transferCacheRequests.
  4. Start OTP
flaktack commented 1 day ago

We can take a look at this next week :eyes:

VillePihlava commented 10 hours ago

I closed this because revert PR https://github.com/opentripplanner/OpenTripPlanner/pull/6214 was merged.