Race condition in resource count while associating IP address to a network
ISSUE TYPE
- Bug Report
COMPONENT NAME
Resource Limits Manager for public_ip
CLOUDSTACK VERSION
CONFIGURATION
OS / ENVIRONMENT
SUMMARY
Due to certain race conditions between checking and incrementing of resource counts, the check can be bypassed. This leads to cases where account's allocated resources exceeds the accounts limit.
STEPS TO REPRODUCE
- Create an account with public ip limit to 2
- Create a network and deploy a VM (This will increase the public_ip count by 1 for the account).
- Allocate different IPs to the same network in parallel (around 4-5 requests).
This sometimes leads to allocated resources exceeding the account's limit.
EXPECTED RESULTS
Count of allocated resources should not exceed the account's limit.
ACTUAL RESULTS
Count of allocated resources exceeded the account's limit.
@vishesh92 is this new behaivure? what version can you (not) see this in?
@vishesh92 is this new behaivure? what version can you (not) see this in?
I am not sure.
This is happening because of the race conditions while incrementing the public_ip count. We need to create a CheckedReservation before allocation of the public_ip.
fixed by #9516