onebusaway-application-modules icon indicating copy to clipboard operation
onebusaway-application-modules copied to clipboard

GtfsRealtimeTripLibrary exception

Open nakkore opened this issue 6 years ago • 5 comments

I came across the following issue because of an apparently invalid trip updates feed. If I've understood correctly the real-time feed contained trips where the start_time was different from the departure_time/arrival_time defined in the static gtfs: in my case was 24:35:00 which represents the same time in different format.

trip_update { trip { trip_id: "VJ0d2212ef07777d1d4cf8a0bf518358dd02f84fdf" start_time: "00:35:00" start_date: "20200105" route_id: "104" }

This small inconsistency triggers the attached exception which can easily fixed by wrapping

blockStartTime = getBlockStartTimeForTripStartTime(instance, tripEntry.getId(), tripStartTime);

in a try-catch block. I'd log the error though.

[GtfsRealtimeSource.java:850] : Error updating from GTFS-realtime data sources
java.lang.NullPointerException
        at org.onebusaway.transit_data_federation.impl.realtime.gtfs_realtime.GtfsRealtimeTripLibrary.getBlockStartTimeForTripStartTime(GtfsRealtimeTripLibrary.java:468)
        at org.onebusaway.transit_data_federation.impl.realtime.gtfs_realtime.GtfsRealtimeTripLibrary.getTripDescriptorAsBlockDescriptor(GtfsRealtimeTripLibrary.java:552)
        at org.onebusaway.transit_data_federation.impl.realtime.gtfs_realtime.GtfsRealtimeTripLibrary.groupTripUpdatesAndVehiclePositions(GtfsRealtimeTripLibrary.java:309)
        at org.onebusaway.transit_data_federation.impl.realtime.gtfs_realtime.GtfsRealtimeSource.handeUpdates(GtfsRealtimeSource.java:417)
        at org.onebusaway.transit_data_federation.impl.realtime.gtfs_realtime.GtfsRealtimeSource.refresh(GtfsRealtimeSource.java:396)
        at org.onebusaway.transit_data_federation.impl.realtime.gtfs_realtime.GtfsRealtimeSource$RefreshTask.run(GtfsRealtimeSource.java:847)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

Thank you

nakkore avatar Jan 08 '20 20:01 nakkore

Thanks @nakkore; what version/branch of onebusaway-application-modules are you seeing this in?

sheldonabrown avatar Jan 09 '20 13:01 sheldonabrown

on the master branch I should have mentioned it sorry

On Thu, 9 Jan 2020, 13:22 sheldonabrown, [email protected] wrote:

Thanks @nakkore https://github.com/nakkore; what version/branch of onebusaway-application-modules are you seeing this in?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/OneBusAway/onebusaway-application-modules/issues/237?email_source=notifications&email_token=AFTYZ2S57NUOWW3HGIJN4MLQ44QKTA5CNFSM4KEOKXH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIQI3WY#issuecomment-572558811, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFTYZ2THB2XGAAFPC6RDJUTQ44QKTANCNFSM4KEOKXHQ .

nakkore avatar Jan 09 '20 13:01 nakkore

BTW the same issue is happening on https://github.com/camsys/onebusaway-application-modules/releases/tag/onebusaway-application-modules-2.0.38-cs

Thanks

nakkore avatar Jan 10 '20 08:01 nakkore

It looks like the trip isn't being found, perhaps because of how the service date is either determined or provided. Likely needs more investigation, but I've at least prevented the exception in this commit.

https://github.com/camsys/onebusaway-application-modules/commit/70b66ba8d76bd38ed5625b80fba4390f94a9cc2c

sheldonabrown avatar Jan 12 '20 14:01 sheldonabrown

cool, thank you.

nakkore avatar Jan 13 '20 20:01 nakkore