Skip to content

Enforce allowWrites for GTFS files #2036

Closed

Description

@gcheval

Describe the bug

With GraphHopper.allowWrites to false, GTFSFeed will still attempt to write in the graph.location folder (even if the gtfs file exists).

The exception returned is: java.io.IOError: java.io.IOException: Parent folder is not writable: graph-cache/gtfs_0.

I was able to circumvent that issue by applying readOnly() to the DBMaker in GTFSFeed.constructDB if the file exists.

To Reproduce

Steps to reproduce the behavior. For examples:

  1. checkout master branch of GraphHopper.
  2. Setup the project following the public transit quickstart. At that point, the cache should have been generated in ./graph-cache.
  3. Remove the write permission on the ./graph-cache folder (chmod -w ./graph-cache).
  4. Set allowWrites to false for GraphHopperGTFS in com.graphhopper.http.GraphHopperManaged#graphHopper line 65.
  5. Start the application.
  6. See exception in the console.

Expected behavior

When GraphHopper has setAllowWrites to true, no class should attempt writing in the graph.location folder.

System Information

Operating system: macOS Mojave 10.14.6 (18G4032)
GraphHopper: 1.0-pre38 and master
JVM:

openjdk version "11.0.5" 2019-10-15
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.5+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.5+10, mixed mode)

Screenshots & Logs

  • Complete stacktrace:
java.io.IOError: java.io.IOException: Parent folder is not writable: graph-cache/gtfs_0
	at org.mapdb.Volume$MappedFileVol.<init>(Volume.java:543)
	at org.mapdb.Volume.volumeForFile(Volume.java:202)
	at org.mapdb.Volume$1.createIndexVolume(Volume.java:276)
	at org.mapdb.StoreDirect.<init>(StoreDirect.java:202)
	at org.mapdb.DBMaker.extendStoreDirect(DBMaker.java:971)
	at org.mapdb.DBMaker.makeEngine(DBMaker.java:758)
	at org.mapdb.DBMaker.make(DBMaker.java:701)
	at com.conveyal.gtfs.GTFSFeed.constructDB(GTFSFeed.java:368)
	at com.conveyal.gtfs.GTFSFeed.<init>(GTFSFeed.java:356)
	at com.graphhopper.reader.gtfs.GtfsStorage.loadExisting(GtfsStorage.java:125)
	at com.graphhopper.reader.gtfs.GraphHopperGtfs.importPublicTransit(GraphHopperGtfs.java:131)
	at com.graphhopper.GraphHopper.postProcessing(GraphHopper.java:974)
	at com.graphhopper.GraphHopper.load(GraphHopper.java:804)
	at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:639)
	at com.graphhopper.http.GraphHopperManaged.start(GraphHopperManaged.java:96)
	at io.dropwizard.lifecycle.JettyManaged.doStart(JettyManaged.java:27)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
	at org.eclipse.jetty.server.Server.start(Server.java:407)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
	at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
	at org.eclipse.jetty.server.Server.doStart(Server.java:371)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
	at io.dropwizard.cli.ServerCommand.run(ServerCommand.java:53)
	at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:45)
	at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:87)
	at io.dropwizard.cli.Cli.run(Cli.java:78)
	at io.dropwizard.Application.run(Application.java:94)
	at com.graphhopper.http.GraphHopperApplication.main(GraphHopperApplication.java:36)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions