Skip to content
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

GraphQL null exception when fetching details of departureStoptime for an added trip #6242

Open
miklcct opened this issue Nov 7, 2024 · 0 comments · May be fixed by #6245
Open

GraphQL null exception when fetching details of departureStoptime for an added trip #6242

miklcct opened this issue Nov 7, 2024 · 0 comments · May be fixed by #6245

Comments

@miklcct
Copy link
Contributor

miklcct commented Nov 7, 2024

Expected behavior

The query doesn't crash.

Observed behavior

The query crashes with the following error:

10:06:03.121 WARN [grizzly-16]  (LoggingDataFetcherExceptionHandler.java:19) Exception while fetching data (/trip/departureStoptime/realtimeDeparture) : Cannot invoke "org.opentripplanner.transit.model.timetable.TripTimes.isCancelledStop(int)" because "this.tripTimes" is null
java.lang.NullPointerException: Cannot invoke "org.opentripplanner.transit.model.timetable.TripTimes.isCancelledStop(int)" because "this.tripTimes" is null
	at org.opentripplanner.model.TripTimeOnDate.isCancelledStop(TripTimeOnDate.java:171)
	at org.opentripplanner.model.TripTimeOnDate.getRealtimeDeparture(TripTimeOnDate.java:134)
	at org.opentripplanner.apis.gtfs.datafetchers.StoptimeImpl.lambda$realtimeDeparture$7(StoptimeImpl.java:67)
	at graphql.execution.ExecutionStrategy.invokeDataFetcher(ExecutionStrategy.java:533)
	at graphql.execution.ExecutionStrategy.fetchField(ExecutionStrategy.java:497)
	at graphql.execution.ExecutionStrategy.fetchField(ExecutionStrategy.java:438)
	at graphql.execution.ExecutionStrategy.resolveFieldWithInfo(ExecutionStrategy.java:397)
	at graphql.execution.ExecutionStrategy.getAsyncFieldValueInfo(ExecutionStrategy.java:335)
	at graphql.execution.ExecutionStrategy.executeObject(ExecutionStrategy.java:214)
	at graphql.execution.ExecutionStrategy.completeValueForObject(ExecutionStrategy.java:963)
	at graphql.execution.ExecutionStrategy.completeValue(ExecutionStrategy.java:701)
	at graphql.execution.ExecutionStrategy.completeField(ExecutionStrategy.java:653)
	at graphql.execution.ExecutionStrategy.resolveFieldWithInfo(ExecutionStrategy.java:409)
	at graphql.execution.ExecutionStrategy.getAsyncFieldValueInfo(ExecutionStrategy.java:335)
	at graphql.execution.ExecutionStrategy.executeObject(ExecutionStrategy.java:214)
	at graphql.execution.ExecutionStrategy.completeValueForObject(ExecutionStrategy.java:963)
	at graphql.execution.ExecutionStrategy.completeValue(ExecutionStrategy.java:701)
	at graphql.execution.ExecutionStrategy.completeField(ExecutionStrategy.java:653)
	at graphql.execution.ExecutionStrategy.resolveFieldWithInfo(ExecutionStrategy.java:409)
	at graphql.execution.ExecutionStrategy.getAsyncFieldValueInfo(ExecutionStrategy.java:335)
	at graphql.execution.AsyncExecutionStrategy.execute(AsyncExecutionStrategy.java:57)
	at graphql.execution.Execution.executeOperation(Execution.java:181)
	at graphql.execution.Execution.execute(Execution.java:117)
	at graphql.GraphQL.execute(GraphQL.java:546)
	at graphql.GraphQL.lambda$parseValidateAndExecute$13(GraphQL.java:476)
	at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1187)
	at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2341)
	at graphql.GraphQL.parseValidateAndExecute(GraphQL.java:471)
	at graphql.GraphQL.lambda$executeAsync$9(GraphQL.java:429)
	at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1187)
	at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2341)
	at graphql.GraphQL.executeAsync(GraphQL.java:418)
	at org.opentripplanner.apis.gtfs.GtfsGraphQLIndex.getGraphQLExecutionResult(GtfsGraphQLIndex.java:229)
	at org.opentripplanner.apis.gtfs.GtfsGraphQLIndex.getGraphQLResponse(GtfsGraphQLIndex.java:244)
	at org.opentripplanner.apis.gtfs.GtfsGraphQLAPI.getGraphQL(GtfsGraphQLAPI.java:91)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:146)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:189)
	at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:93)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:478)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:400)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:81)
	at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:274)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:266)
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:253)
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:696)
	at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:367)
	at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:190)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:535)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:515)
	at java.base/java.lang.Thread.run(Thread.java:1583)```

Version of OTP used

2.7.0-SNAPSHOT

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

The same as in #6197
GTFS: combined_gtfs.zip
OSM: Greenwich.osm.zip (extract the PBF from the zip)
RT feeds:
test_gtfsrt.zip (use the version 1), text shown below.

RT feed version 1

header {
  gtfs_realtime_version: "2.0"
  incrementality: FULL_DATASET
  timestamp: 1729862503
}
entity {
  id: "ADD_1"
  trip_update {
    trip {
      trip_id: "ADD_1"
      start_time: "10:00:00"
      start_date: "20241101"
      schedule_relationship: ADDED
      route_id: "Cable Car"
    }
    stop_time_update {
      stop_sequence: 0
      arrival {
        time: 1730455200
      }
      departure {
        time: 1730455200
      }
      stop_id: "9400ZZALGWP1"
    }
    stop_time_update {
      stop_sequence: 1
      arrival {
        time: 1730455500
      }
      departure {
        time: 1730455500
      }
      stop_id: "9400ZZALRDK1"
    }
  }
}

Command line used to start OTP

java -Xmx16G -jar otp-shaded.jar --load --save --serve workspace

Router config and graph build config JSON

build-config.json

{
	"areaVisibility": true,
	"dataImportReport": true,
	"maxTransferDuration": "PT15M",
	"multiThreadElevationCalculations": true,
	"staticBikeParkAndRide" : true,
	"staticParkAndRide" : true,
	"subwayAccessTime": "0.0",
	"transitModelTimeZone": "Europe/London",
	"transitServiceEnd": "P3M",
	"transitServiceStart": "P-7D",
	"boardingLocationTags": ["naptan:AtcoCode", "naptan:NaptanCode"],
	"osmDefaults" : {
		"osmTagMapping" : "uk",
		"timeZone" : "Europe/London"
	},
	"transitFeeds" : [
		{
			"type" : "gtfs",
			"feedId" : "GB",
			"source" : "combined_gtfs.zip"
		}
	]
}

router-config.json

{
  "routingDefaults": { 
    "drivingDirection": "left",
    "locale": "en_GB",
    "numItineraries": 10,
    "searchWindow": "PT6H",
    "transferSlack": "PT30S",
    "waitReluctance": 1.76,
    "accessEgress": {
      "maxDuration": "PT2H"
    },
    "walk": {
      "boardCost": 300,
      "reluctance": 1.68
    },
    "wheelchairAccessibility": {
      "trip": {
        "onlyConsiderAccessible": false,
        "unknownCost": 600,
        "inaccessibleCost": 3600
      },
      "stop": {
        "onlyConsiderAccessible": false,
        "unknownCost": 600,
        "inaccessibleCost": 3600
      },
      "elevator": {
        "onlyConsiderAccessible": false
      },
      "inaccessibleStreetReluctance": 25,
      "maxSlope": 0.08333,
      "slopeExceededReluctance": 50,
      "stairsReluctance": 25
    }
  },
  "timetableUpdates": {
    "maxSnapshotFrequency": "PT1S" 
  },
  "transit": {
    "searchThreadPoolSize": 4,
    "transferCacheRequests": [
      {
        "modes" : "WALK",
        "walk" : {
          "boardCost" : 300,
          "reluctance" : 1.68
        }
      }
    ]
  },
  "updaters" : [
    {
      "type" : "stop-time-updater",
      "frequency" : "5s",
      "url" : "file:///Users/Michael/projects/workspace/test_gtfsrt.binpb",
      "feedId" : "GB"
    }
  ]
}

Steps to reproduce the problem

Run the following query on an added trip:

query GtfsExampleQuery {
  trip(id:"GB:ADD_1") {
    departureStoptime {
      realtimeDeparture
    }
  }
}
@miklcct miklcct changed the title GraphQL null exception when fetching details of departureStoptime for an added journey GraphQL null exception when fetching details of departureStoptime for an added trip Nov 8, 2024
miklcct added a commit to Jnction/OpenTripPlanner that referenced this issue Nov 8, 2024
miklcct added a commit to Jnction/OpenTripPlanner that referenced this issue Nov 8, 2024
@miklcct miklcct linked a pull request Nov 8, 2024 that will close this issue
miklcct added a commit to Jnction/OpenTripPlanner that referenced this issue Nov 8, 2024
miklcct added a commit to Jnction/OpenTripPlanner that referenced this issue Nov 8, 2024
miklcct added a commit to Jnction/OpenTripPlanner that referenced this issue Nov 8, 2024
miklcct added a commit to Jnction/OpenTripPlanner that referenced this issue Nov 8, 2024
miklcct added a commit to Jnction/OpenTripPlanner that referenced this issue Nov 8, 2024
miklcct added a commit to Jnction/OpenTripPlanner that referenced this issue Nov 8, 2024
miklcct added a commit to Jnction/OpenTripPlanner that referenced this issue Nov 8, 2024
miklcct added a commit to Jnction/OpenTripPlanner that referenced this issue Nov 8, 2024
miklcct added a commit to Jnction/OpenTripPlanner that referenced this issue Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant