Skip to content

Safe Usage from multiple GraphHopper instances (or JVMs) #112

Closed

Description

@karussell

At the moment graphhopper fails silently (BAD!) if two processes are concurrently writing to the folder, or one process is writing and another is reading partial information.

Fix: Create a lock file in the graphhopper folder if an GH instance is writing to it - e.g. for RAM_STORE. For MMAP all the time. And then check for this lock file on load (regardless of the DAType) and throw an exception if it exists. Additionally if it is RAM_STORE and the directory contains at least ONE MMAP dataacess object use the MMAP variant!

But make sure two RAM_STORE instances can still read the folder (loadExisting)!

Problems:

  • removing the lock file even if the process was interrupted or ended via CTRL+C. But there could be an option -forceLockFileRemoval or similar to workaround this.
  • FileChange.lock is probably not appropriated as we need to block access to a file also for multiple instances in one JVM and it does not really work for NFS as noted here

Activity

  1. added a commit that references this issue on Jun 16, 2014
  2. added a commit that references this issue on Jun 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions