Uploaded image for project: 'Fedora Repository Project'
  1. Fedora Repository Project
  2. FCREPO-1284

Write lock in DefaultDOManager can cause lost updates when, e.g., adding relationships from multiple threads

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Fedora 3.8.0
    • Fix Version/s: Fedora 3.8.1
    • Component/s: legacy - Fedora
    • Labels:
      None

      Description

      The implementation of getWriteLock in DefaultDOManager was changed a while ago to allow for improved ingest throughput:

      https://jira.duraspace.org/browse/FCREPO-1024

      However, since the write lock for an object is obtained after reading and deserializing an object, adding relationships to an object from multiple threads at the same time can result in lost updates, because a later thread may modify a datastream using stale data. Previously, if two threads tried to obtain a writer on the same object at the same time, an exception would be thrown.

      A possible fix is to obtain the write lock before reading and deserializing the object. I've prepared a unit test and a small patch here:

      https://github.com/UNC-Libraries/fcrepo/compare/read-write-lock

        Attachments

          Activity

            People

            • Assignee:
              sprater Scott Prater
              Reporter:
              daines Mike Daines
              Reviewer:
              Benjamin Armintor
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: