Uploaded image for project: 'Apache Curator'
  1. Apache Curator
  2. CURATOR-719

Race condition enabled by combination of creatingParentsIfNeeded and orSetData

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 5.8.0
    • Framework
    • None

    Description

      When using create().orSetData().creatingParentsIfNeeded().forPath(path, data), a race condition exists that will ignore the orSetData() option if parents aren't created.

      So if there are two parallel processes creating the same node with the settings above, both will hit a "NoNodeException", which will take them down the path of creating the parents. Once both are done with that, which seems to handle the parallelism fine, they will both try to create the target zNode (path above). However, in this code path, the orSetData() option is not used, so one will succeed, and create the zNode, and the other will fail because the zNode has already been created by the other process.

      What should happen, is that the orSetData() option is used in this catch (NoNodeException) block, and the second process will set the data and not throw an error.

      Attachments

        Issue Links

          Activity

            People

              houston Houston Putman
              houston Houston Putman
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: