hsato03 opened a new pull request, #9234: URL: https://github.com/apache/cloudstack/pull/9234
### Description When executing many operations simultaneously with a public IP, some inconsistencies are being implemented in the environment, such as the duplicate public IP (#8967). For this reason, this PR adds a lock to most APIs that manipulate a public IP, preventing inconsistencies that may occur due to race conditions. ### Types of changes - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] New feature (non-breaking change which adds functionality) - [X] Bug fix (non-breaking change which fixes an issue) - [ ] Enhancement (improves an existing feature and functionality) - [ ] Cleanup (Code refactoring and cleanup, that may add test cases) - [ ] build/CI ### Feature/Enhancement Scale or Bug Severity #### Feature/Enhancement Scale - [ ] Major - [ ] Minor #### Bug Severity - [ ] BLOCKER - [ ] Critical - [X] Major - [ ] Minor - [ ] Trivial ### Screenshots (if appropriate): ### How Has This Been Tested? All tests were done following the same steps but using different APIs that create rules for the IP (`createLoadBalancerRule`, `createFirewallRule`, `createPortForwardingRule`, `createIpForwardingRule`): 1. Associate a public IP with a network; 2. Create a rule with one of the APIs; 3. Disassociate the IP (before) and create a rule again (after) at the same time. To test the `createRemoteAccessVpn` API, I created a firewall rule in step 2 and called the `createRemoteAccessVpn` API in step 3. **Before**: The `disassociateIpAddress` API threw an exception and still disassociated the IP from the VR. The APIs that kept the IP in the VR even after disassociation were `createLoadBalancerRule` and `createRemoteAccessVpn`. **Now**: All APIs that create rules for the IP wait for the `disassociateIpAddress` API to finish executing and only then begin execution, meaning that the exception is now thrown when creating the rule and no longer when disassociating the IP. No API held the IP in the VR. The tests were made in high and low performance environments. The low performance environments were more susceptible to race conditions due to the time it takes to process a request. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org