You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by "Houston Putman (Jira)" <ji...@apache.org> on 2024/10/23 16:20:00 UTC
[jira] [Created] (CURATOR-719) Race condition enabled by combination of creatingParentsIfNeeded and orSetData
Houston Putman created CURATOR-719:
--------------------------------------
Summary: Race condition enabled by combination of creatingParentsIfNeeded and orSetData
Key: CURATOR-719
URL: https://issues.apache.org/jira/browse/CURATOR-719
Project: Apache Curator
Issue Type: Bug
Components: Framework
Reporter: Houston Putman
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.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)