We found that we sometimes run out of stock/inventory due to orders pending payment. Is there a way to "release" those stock/inventory after a specified amount of time, automatically, without us having to check regularly for orders pending payment and cancelling manually?
One of the solutions is to create a cron job that will cancel the orders left waiting for payment X hour or days after they were created.
That way your stocks would be updated.
Here you can find explanations and examples on how to configure and create cron tasks :
Here it is same logic for Magento 1 : How to automatically cancel pending orders after a specified amount of time?
you can see some magento 2 extension provider company selling magento 2 auto cancel order extension you can check this https://www.mageants.com/auto-cancel-order-for-magento-2.html if your requirement fulfil with this