opentripplanner / OpenTripPlanner

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

ArrayIndexOutOfBoundsException when applying trip updates #3110

Open gmellemstrand opened 4 years ago

gmellemstrand commented 4 years ago

NOTE: this issue system is intended for reporting bugs and tracking progress in software development. For all other usage and software development questions or discussion, please write to one of the mailing lists (Google groups): https://groups.google.com/forum/#!forum/opentripplanner-dev https://groups.google.com/forum/#!forum/opentripplanner-users

Expected behavior

Observed behavior

OTP throws an ArrayIndexOutOfBoundsException when applying trip updates on the Dutch graph.

11:04:24.628 ERROR (GraphUpdaterManager.java:153) Error while running graph writer org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable: java.lang.ArrayIndexOutOfBoundsException: Index 12 out of bounds for length 12 at org.opentripplanner.model.TripPattern.setHopGeometriesFromPattern(TripPattern.java:173) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TripPatternCache.getOrCreateTripPattern(TripPatternCache.java:63) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.addTripToGraphAndBuffer(TimetableSnapshotSource.java:697) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.handleModifiedTrip(TimetableSnapshotSource.java:895) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.validateAndHandleModifiedTrip(TimetableSnapshotSource.java:861) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.applyTripUpdates(TimetableSnapshotSource.java:237) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable.run(TripUpdateGraphWriterRunnable.java:46) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.GraphUpdaterManager.lambda$execute$0(GraphUpdaterManager.java:151) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na] at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na] at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na] 11:04:24.655 ERROR (GraphUpdaterManager.java:153) Error while running graph writer org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable: java.lang.ArrayIndexOutOfBoundsException: Index 28 out of bounds for length 28 at org.opentripplanner.model.TripPattern.setHopGeometriesFromPattern(TripPattern.java:173) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TripPatternCache.getOrCreateTripPattern(TripPatternCache.java:63) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.addTripToGraphAndBuffer(TimetableSnapshotSource.java:697) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.handleModifiedTrip(TimetableSnapshotSource.java:895) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.validateAndHandleModifiedTrip(TimetableSnapshotSource.java:861) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.applyTripUpdates(TimetableSnapshotSource.java:237) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable.run(TripUpdateGraphWriterRunnable.java:46) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.GraphUpdaterManager.lambda$execute$0(GraphUpdaterManager.java:151) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na] at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na] at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na] 11:04:24.656 ERROR (GraphUpdaterManager.java:153) Error while running graph writer org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable: java.lang.ArrayIndexOutOfBoundsException: Index 8 out of bounds for length 8 at org.opentripplanner.model.TripPattern.setHopGeometriesFromPattern(TripPattern.java:173) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TripPatternCache.getOrCreateTripPattern(TripPatternCache.java:63) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.addTripToGraphAndBuffer(TimetableSnapshotSource.java:697) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.handleModifiedTrip(TimetableSnapshotSource.java:895) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.validateAndHandleModifiedTrip(TimetableSnapshotSource.java:861) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.applyTripUpdates(TimetableSnapshotSource.java:237) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable.run(TripUpdateGraphWriterRunnable.java:46) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.GraphUpdaterManager.lambda$execute$0(GraphUpdaterManager.java:151) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na] at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na] at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na] 11:04:24.740 ERROR (GraphUpdaterManager.java:153) Error while running graph writer org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable: java.lang.ArrayIndexOutOfBoundsException: Index 6 out of bounds for length 6

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

Latest dev-2.x

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

I don't know it these are public, so I will leave it up to @sven4all to provide them.

Command line used to start OTP

Router config and graph build config JSON

Steps to reproduce the problem

Start up OTP with the Dutch graph and realtime updaters.

sven4all commented 4 years ago

The error has changed a little bit.

08:28:43.033 ERROR (GraphUpdaterManager.java:153) Error while running graph writer org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable: java.lang.ArrayIndexOutOfBoundsException: null 08:28:43.129 ERROR (Timetable.java:363) Part of a TripUpdate object could not be applied successfully to trip 89749558. 08:28:43.129 WARN (TimetableSnapshotSource.java:244) Failed to apply TripUpdate. 08:28:43.129 ERROR (Timetable.java:363) Part of a TripUpdate object could not be applied successfully to trip 91258092. 08:28:43.129 WARN (TimetableSnapshotSource.java:244) Failed to apply TripUpdate. 08:28:43.130 ERROR (GraphUpdaterManager.java:153) Error while running graph writer org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable: java.lang.ArrayIndexOutOfBoundsException: null 08:28:43.768 ERROR (GraphUpdaterManager.java:153) Error while running graph writer org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable: java.lang.ArrayIndexOutOfBoundsException: null 08:28:43.769 ERROR (GraphUpdaterManager.java:153) Error while running graph writer org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable: java.lang.ArrayIndexOutOfBoundsException: null 08:28:45.667 ERROR (GraphUpdaterManager.java:153) Error while running graph writer org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable: java.lang.ArrayIndexOutOfBoundsException: null 08:28:45.667 ERROR (Timetable.java:363) Part of a TripUpdate object could not be applied successfully to trip 90281352. 08:28:45.667 WARN (TimetableSnapshotSource.java:244) Failed to apply TripUpdate. 08:28:45.667 ERROR (GraphUpdaterManager.java:153) Error while running graph writer org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable: java.lang.ArrayIndexOutOfBoundsException: null 08:28:45.667 ERROR (GraphUpdaterManager.java:153) Error while running graph writer org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable: java.lang.ArrayIndexOutOfBoundsException: null 08:28:45.670 ERROR (GraphUpdaterManager.java:153) Error while running graph writer org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable: java.lang.ArrayIndexOutOfBoundsException: null 08:28:45.670 ERROR (GraphUpdaterManager.java:153) Error while running graph writer org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable: java.lang.ArrayIndexOutOfBoundsException: null 08:28:45.670 ERROR (GraphUpdaterManager.java:153) Error while running graph writer org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable: java.lang.ArrayIndexOutOfBoundsException: null 08:28:45.672 ERROR (GraphUpdaterManager.java:153) Error while running graph writer org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable: java.lang.ArrayIndexOutOfBoundsException: null 08:28:45.673 ERROR (GraphUpdaterManager.java:153) Error while running graph writer org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable: java.lang.ArrayIndexOutOfBoundsException: null 08:28:45.674 ERROR (GraphUpdaterManager.java:153) Error while running graph writer org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable: java.lang.ArrayIndexOutOfBoundsException: null 08:28:45.767 ERROR (GraphUpdaterManager.java:153) Error while running graph writer org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable: java.lang.ArrayIndexOutOfBoundsException: null

sven4all commented 4 years ago

Hmm not really

08:49:11.499 ERROR (GraphUpdaterManager.java:153) Error while running graph writer org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable: java.lang.ArrayIndexOutOfBoundsException: Index 12 out of bounds for length 12 at org.opentripplanner.model.TripPattern.setHopGeometriesFromPattern(TripPattern.java:172) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TripPatternCache.getOrCreateTripPattern(TripPatternCache.java:63) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.addTripToGraphAndBuffer(TimetableSnapshotSource.java:697) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.handleModifiedTrip(TimetableSnapshotSource.java:895) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.validateAndHandleModifiedTrip(TimetableSnapshotSource.java:861) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.applyTripUpdates(TimetableSnapshotSource.java:237) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable.run(TripUpdateGraphWriterRunnable.java:46) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.GraphUpdaterManager.lambda$execute$0(GraphUpdaterManager.java:151) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na] at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na] at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na] 08:49:11.953 ERROR (GraphUpdaterManager.java:153) Error while running graph writer org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable: java.lang.ArrayIndexOutOfBoundsException: Index 8 out of bounds for length 8 at org.opentripplanner.model.TripPattern.setHopGeometriesFromPattern(TripPattern.java:172) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TripPatternCache.getOrCreateTripPattern(TripPatternCache.java:63) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.addTripToGraphAndBuffer(TimetableSnapshotSource.java:697) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.handleModifiedTrip(TimetableSnapshotSource.java:895) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.validateAndHandleModifiedTrip(TimetableSnapshotSource.java:861) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.applyTripUpdates(TimetableSnapshotSource.java:237) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable.run(TripUpdateGraphWriterRunnable.java:46) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at org.opentripplanner.updater.GraphUpdaterManager.lambda$execute$0(GraphUpdaterManager.java:151) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na] at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na] at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]

hannesj commented 4 years ago

I'm seeing a slightly different error with the following stack trace:

19:58:40.902 ERROR (GraphUpdaterManager.java:153) Error while running graph writer org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable:
java.lang.ArrayIndexOutOfBoundsException: Index 29 out of bounds for length 29
    at org.opentripplanner.routing.trippattern.TripTimes.getArrivalTime(TripTimes.java:265) ~[classes/:na]
    at org.opentripplanner.routing.trippattern.TripTimes.getRunningTime(TripTimes.java:283) ~[classes/:na]
    at org.opentripplanner.model.Timetable.finish(Timetable.java:138) ~[classes/:na]
    at org.opentripplanner.model.TimetableSnapshot.commit(TimetableSnapshot.java:267) ~[classes/:na]
    at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.getTimetableSnapshot(TimetableSnapshotSource.java:147) ~[classes/:na]
    at org.opentripplanner.updater.stoptime.TimetableSnapshotSource.applyTripUpdates(TimetableSnapshotSource.java:259) ~[classes/:na]
    at org.opentripplanner.updater.stoptime.TripUpdateGraphWriterRunnable.run(TripUpdateGraphWriterRunnable.java:46) ~[classes/:na]
    at org.opentripplanner.updater.GraphUpdaterManager.lambda$execute$0(GraphUpdaterManager.java:151) ~[classes/:na]
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na]
    at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) ~[na:na]
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) ~[na:na]
    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
    at java.base/java.lang.Thread.run(Thread.java:830) ~[na:na]

This happens after I've received a stop time update with the last three stops skipped, creating a TripTimes object with less stop times than stops in the pattern, which are looped over.

The root cause is that timetable.get returns the original pattern, as its id has been overwritten with the original pattern's id. As the TripPattern used as key is an instance of TransitEntity its hash and equals functions are based only on the id, thus returning the wrong pattern.

t2gran commented 4 years ago

The #3166 fix the "hash and equals" problem, I just merged that into dev-2.x, but I think it should be merged into the 2.0-rc as well. If someone can verify that the current dev-2.x fixes this problem, then I can provide a PR for the 2.0-rc as well.

sven4all commented 4 years ago

Will test that on dev-2.x

sven4all commented 4 years ago

It seems that dev-2.x is not giving this error anymore. But planning trips isn't possible at all at this moment and results in a 500 error with the following stacktrace.

java.lang.IllegalStateException: Duplicate key NL-NOTRAIN:43040:1:02 (attempted merging values TripPatternForDate{tripPattern=TripPattern{id=NL-NOTRAIN:43040:1:02, transitMode=BUS}, localDate=2020-09-30} and TripPatternForDate{tripPattern=TripPattern{id=NL-NOTRAIN:43040:1:02, transitMode=BUS}, localDate=2020-09-30})
        at java.base/java.util.stream.Collectors.duplicateKeyException(Collectors.java:133) ~[na:na]
        at java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:180) ~[na:na]
        at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) ~[na:na]
        at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[na:na]
        at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[na:na]
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1654) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na]
        at org.opentripplanner.routing.algorithm.raptor.transit.request.RaptorRoutingRequestTransitDataCreator.filterActiveTripPatterns(RaptorRoutingRequestTransitDataCreator.java:160) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.opentripplanner.routing.algorithm.raptor.transit.request.RaptorRoutingRequestTransitDataCreator.getTripPatternsForDateRange(RaptorRoutingRequestTransitDataCreator.java:81) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.opentripplanner.routing.algorithm.raptor.transit.request.RaptorRoutingRequestTransitDataCreator.createTripPatternsPerStop(RaptorRoutingRequestTransitDataCreator.java:58) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.opentripplanner.routing.algorithm.raptor.transit.request.RaptorRoutingRequestTransitData.<init>(RaptorRoutingRequestTransitData.java:61) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.opentripplanner.routing.algorithm.RoutingWorker.routeTransit(RoutingWorker.java:141) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.opentripplanner.routing.algorithm.RoutingWorker.route(RoutingWorker.java:103) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.opentripplanner.routing.RoutingService.route(RoutingService.java:54) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.opentripplanner.api.resource.PlannerResource.plan(PlannerResource.java:77) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
        at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:205) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:308) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.glassfish.jersey.internal.Errors.process(Errors.java:315) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.glassfish.jersey.internal.Errors.process(Errors.java:297) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.glassfish.jersey.internal.Errors.process(Errors.java:267) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:291) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1140) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:375) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:224) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545) ~[otp-2.0.0-SNAPSHOT-shaded.jar:1.1]

Also there are a lot of these errors, but that could be a data problem (providing RT data when static data is not present for example)

13:10:53.070 ERROR (Timetable.java:363) Part of a TripUpdate object could not be applied successfully to trip 92885437.
13:10:53.070 WARN (TimetableSnapshotSource.java:244) Failed to apply TripUpdate.
13:10:53.070 ERROR (Timetable.java:363) Part of a TripUpdate object could not be applied successfully to trip 92893389.
13:10:53.070 WARN (TimetableSnapshotSource.java:244) Failed to apply TripUpdate.
13:10:54.043 ERROR (Timetable.java:363) Part of a TripUpdate object could not be applied successfully to trip 92917900.
13:10:54.043 WARN (TimetableSnapshotSource.java:244) Failed to apply TripUpdate.
13:10:54.043 ERROR (Timetable.java:363) Part of a TripUpdate object could not be applied successfully to trip 92908372.
13:10:54.043 WARN (TimetableSnapshotSource.java:244) Failed to apply TripUpdate.
13:10:54.384 ERROR (Timetable.java:363) Part of a TripUpdate object could not be applied successfully to trip 92909256.
13:10:54.384 WARN (TimetableSnapshotSource.java:244) Failed to apply TripUpdate.
t2gran commented 4 years ago

Thank you for testing this @sven4all. I think I will ask about this error at tomorrows developer meeting, feel free to join ( https://meet.google.com/qwh-xzbz-atr at 10:00 CEST).

t2gran commented 4 years ago

Hi @sven4all, this should be fixed in the 2.0-rc now, could you be so kind to test it again, and I will close this issue if it works. I will merge the 2.0-rc branch into dev-2.x.

sven4all commented 4 years ago

Yes it works! https://github.com/opentripplanner/OpenTripPlanner/pull/3202

t2gran commented 4 years ago

Thank you for great work on this one, I will close the issue since we have a confirmation that the bug is fixed.

miklcct commented 2 weeks ago

I am encountering the same issue which is preventing the update on the latest 2.6.0 release:

16:38:24.656 ERROR [graph-writer]  (GraphUpdaterManager.java:189) Error while running graph writer org.opentripplanner.updater.trip.TripUpdateGraphWriterRunnable:
java.lang.ArrayIndexOutOfBoundsException: Index 6 out of bounds for length 6
        at org.opentripplanner.transit.model.network.TripPattern.getHopGeometry(TripPattern.java:183)
        at org.opentripplanner.transit.model.network.TripPatternBuilder.generateHopGeometriesFromOriginalTripPattern(TripPatternBuilder.java:194)
        at org.opentripplanner.transit.model.network.TripPatternBuilder.hopGeometries(TripPatternBuilder.java:164)
        at org.opentripplanner.transit.model.network.TripPattern.<init>(TripPattern.java:142)
        at org.opentripplanner.transit.model.network.TripPatternBuilder.buildFromValues(TripPatternBuilder.java:120)
        at org.opentripplanner.transit.model.network.TripPatternBuilder.buildFromValues(TripPatternBuilder.java:17)
        at org.opentripplanner.transit.model.framework.AbstractBuilder.build(AbstractBuilder.java:33)
        at org.opentripplanner.updater.trip.TripPatternCache.getOrCreateTripPattern(TripPatternCache.java:72)
        at org.opentripplanner.updater.trip.TimetableSnapshotSource.addTripToGraphAndBuffer(TimetableSnapshotSource.java:842)
        at org.opentripplanner.updater.trip.TimetableSnapshotSource.handleAddedTrip(TimetableSnapshotSource.java:681)
        at org.opentripplanner.updater.trip.TimetableSnapshotSource.validateAndHandleAddedTrip(TimetableSnapshotSource.java:509)
        at org.opentripplanner.updater.trip.TimetableSnapshotSource.applyTripUpdates(TimetableSnapshotSource.java:235)
        at org.opentripplanner.updater.trip.TripUpdateGraphWriterRunnable.run(TripUpdateGraphWriterRunnable.java:48)
        at org.opentripplanner.updater.GraphUpdaterManager.lambda$execute$1(GraphUpdaterManager.java:187)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1583)

It doesn't happen all the time with my dataset, but once it happens, the only way to fix it is to restart OpenTripPlanner, and I have no idea specifically what update will cause it to happen.

t2gran commented 1 week ago

We are currently refactoring and cleaning up the RT updaters. Not sure if there are someone who will look into this problem, but we are aware that the way patterns are added to OTP is not thread safe - it might look like this is the cause of this problem. We are in the process of fixing the design(underlying cause). It would be nice if you, @miklcct , could report back on this problem when we have refactored the RT pattern "index/cashe". I am not aware if it is possible to recreate this problem outside your environment (the Siri updators can be feed by file updates, not sure if the GTFS can). But, if you can produce the data and the recipe to reproduce the error, then we could test it.

miklcct commented 1 week ago

I'll put this problem on hold then. Unfortunately we haven't built the infrastructure to deliver our GTFS-RT feed to the public yet (our current setup is to produce and consume the updates locally) and we will revisit again in the future.