-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
High memory and cpu usage with the cron jobs #499
Comments
@noeli-getjohn thank you for reaching out with these findings:-
|
Hello We have installed this extension and found same below error, If we disable UpdateOrdersToProcessing this cron then it will create any issue?. ERROR :- Hope to hear from you ASAP. |
Hello,
We installed this extension v4.1.6 on our Magento(v2.4.5-p2) site recently.
But we got very high memory and cpu usage with the cron group "razorpay", which made the server crash.
In our investigation, we found two critical issues in your module.
When Razorpay\Magento\Cron\UpdateOrdersToProcessing is run, we got this error in the line 188.
Cron Job razorpay_update_order_to_processing has an error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'rzp_update_order_cron_status' in 'where clause'
It means the
sales_order
table is missing the columnrazorpay_update_order_to_processing
.So we checked Razorpay\Magento\Setup\UpgradeSchema and found an issue in the line 78.
Current code: $tableName =
$setup->getTable(OrderLink::TABLE_NAME);
I think it should be
$tableName = $setup->getTable('sales_order');
.When Razorpay\Magento\Cron\CancelPendingOrders is run, the excution time takes forever in the line 117.
The error:
Could not acquire lock for cron job: razorpay_cancel_pending_orders
So it uses a lot of memory and cpu.
Ther reason is because we have a lot of the orders and specially, a lot of the pending orders.
total orders number: 85k
total pending orders number: 35k
So it's taking too much time to get these pending order.
I don't think it needs to get all the pending orders before the pending order timeout because the cron job is run per 5 mins. If so, it will make the same issue for all the sites having lots of pending orders.
I think there should be a minium time limit to add to the searchCriteria filter that considers if the site doesn't have the cron install for some reason for a while. It will solve the issue.
We forked your repository and fixed the issues in those way. Now the cron jobs work perfectly and solved the high memory and cpu usage issue.
We will make a pull request with those fixes soon. If you merge it or make better fixes for the issues, we can install this module from your github repo by composer.
Hope to hear from you soon.
Thanks!
The text was updated successfully, but these errors were encountered: