When we have an inventoried item that sells through very quickly, we can run into problems having Magento manage inventory. Ex: If an product assigned with 200 units, it sold through so quickly that we had multiple orders come in at the same exact second. Each time an order comes in at the same exact second, Magento only decrements the inventory for ONE of those orders, and therefore we oversell.
The above statement might be not accurate reason of this but it seems Magento lock tables during each order transaction and incase of any deadlock (due to other requests on same tables) it rollback whole transaction and inventory calculation logic fails. We found this happen during product launches when there is heavy traffic, the inventory stock is not syncing up fast enough and we are ending up having more orders in system than we have the inventory for.
In short, stock inventory reverting, leading to products being oversold.
Detail of Magento Version and server:
- Magento Version: Adobe Commerce ver. 2.4.5-p2
- Database server: It's a mult-master replication using Galera setup and having multiple databases nodes (3+)
- Application server: More then 20 Web Application nodes