Skip to content

Allow use of alternate file locking primitives #1542

Closed

Description

@kevinushey

Currently, RStudio Server uses ::link() for construction of hard links, as the atomicity of this operation is guaranteed on older networked file systems.

However, not all networked filesystems support hard links. For example, the MapR NFS supports neither advisory file locks nor hard links, and so users are unable to use file locks on those systems and hence are limited in the RSP feature set they can use (e.g. multiple sessions). There are a couple ways forward here -- as per https://community.mapr.com/thread/7192

MapR's NFS does not support locking currently. However, directory-operations are atomic, creating a lock file using O_EXCL, and testing for its presence is an alternative to flock() or lockf().

Therefore, we could in theory use '::mkdir()' or '::open(..., O_CREAT | O_EXCL)' as alternatives, and allow users to opt-in to those behaviors in their lockfile configuration file.

It might be worth considering whether we could just automatically detect and use the appropriate primitive based on what operations appear to be supported on the active filesystem, but it's probably better to just leave the onus on the user.

Activity

  1. self-assigned this
    on Oct 3, 2017
  2. jmcphers commented on Oct 3, 2017

    @jmcphers
    Member

    Another idea in this vein is to use touch or similar to organically update the write time of the file by actually writing to it; we've seen some installations on which this call fails:

    lockFilePath.setLastWriteTime();

  3. added this to the v1.3 milestone on Sep 24, 2018
  4. kevinushey commented on Oct 30, 2019

    @kevinushey
    CollaboratorAuthor

    It looks like this was implemented (fall back to ::open()) with 96d2c1a.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions