opentripplanner / OpenTripPlanner

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

GBFS: org.mobilitydata.gbfs:Timezone.value() returning null, resulting in exception thrown and data not loading #6066

Closed fpurcell closed 1 day ago

fpurcell commented 4 days ago

Observed behavior

OTP seemingly not parsing timezone info from this feed: https://gbfs.biketownpdx.com/gbfs/2.3/gbfs.json The result is that the data is not loaded into OTP, and this exception being thrown:

10:59:11.490 ERROR [updater-0] (PollingGraphUpdater.java:68) Error while running polling updater VehicleRentalUpdater{source: GbfsVehicleRentalDataSource{url: 'https://gbfs.biketownpdx.com/gbfs/2.3/gbfs.json'}} java.lang.NullPointerException: Cannot invoke "org.mobilitydata.gbfs.v2_3.system_information.GBFSData$Timezone.value()" because the return value of "org.mobilitydata.gbfs.v2_3.system_information.GBFSData.getTimezone()" is null at org.opentripplanner.updater.vehicle_rental.datasources.GbfsSystemInformationMapper.mapSystemInformation(GbfsSystemInformationMapper.java:45). at org.opentripplanner.updater.vehicle_rental.datasources.GbfsVehicleRentalDataSource.getUpdates(GbfsVehicleRentalDataSource.java:69) at org.opentripplanner.updater.vehicle_rental.VehicleRentalUpdater.runPolling(VehicleRentalUpdater.java:133) at org.opentripplanner.updater.spi.PollingGraphUpdater.run(PollingGraphUpdater.java:52) at org.opentripplanner.updater.GraphUpdaterManager.lambda$startUpdaters$0(GraphUpdaterManager.java:100) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:358) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) 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)

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

version: 2.6.0-SNAPSHOT, commit: c19cef594d0696e5424398fe87acd317ab6ddf93 (earlier versions too ... sometime in past 6 months, this broke I believe)

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

https://maps.trimet.org/ct/

Router config and graph build config JSON

https://maps.trimet.org/ct/router-config.json https://maps.trimet.org/ct/build-config.json https://maps.trimet.org/ct/otp-config.json

hbruch commented 4 days ago

I'd consider this a data error and not an OTP bug.

The GBFS spec says:

Timezone - TZ timezone from the https://www.iana.org/time-zones. Timezone names never contain the space character but MAY contain an underscore. Refer to https://en.wikipedia.org/wiki/List_of_tz_zones for a list of valid values. Example: Asia/Tokyo, America/Los_Angeles or Africa/Cairo.

Instead of US/Pacific, the system_information.timezone thus should be America/Los_Angeles.

Besides this error, the GBFS Validator raises a couple of other issues with this feed, which might impact it's usability.

leonardehrenfried commented 4 days ago

So all the links in https://gbfs.biketownpdx.com/gbfs/2.3/gbfs.json point to gbfs.lyft.com URLs, so I'm assuming https://gbfs.lyft.com/gbfs/2.3/pdx/gbfs.json is now the canonical URL.

If you enter that URL into the GBFS validator you will see that the time zone is indeed incorrect. It's given as US/Pacific which is a link to America/Los_Angeles. Unfortunately, not many libraries or languages (like Java) support these links and that's why they are not allowed by the GBFS standard.

leonardehrenfried commented 4 days ago

Ah, @hbruch beat me to it. Do you know someone at Lyft that could fix this, @fpurcell?

fpurcell commented 4 days ago

I do not know anyone at Lyft, Leonard. Going to blindly send some alerts to folks tho, and hope for a response (low expectation that this will be resolved any time soon).

fpurcell commented 4 days ago

Having seen the data quality of GBFS and GTFS feeds for many years, my opinion would that OTP code not be so rigid and have work-arounds for such errors. In the case of timezone, it's my opinion that OTP should default to the system timezone, rather than throw an exception based on a null value from the parser.

leonardehrenfried commented 1 day ago

Thing is, even if the timezone problem was solved, there are other errors in the feed, namely in station_status and free_bike_status.

I am looking up people on LinkedIn who work on Lyft GBFS will send a few messages.

fpurcell commented 1 day ago

BTW, colleague Mike M. is reaching out to folks from City of Portland, who contract with Lyft for the service. Will see how it goes. I'll close the ticket.