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
\Klaviyo\Reclaim\Plugin\Api\CartSearchRepository::afterGetList Infinite Loop #133
Comments
@pmclain I am seeing that this issue has been logged by @ihor-sviziev here which leads me to think its a magento issue. I will check if the latest version 2.4.3 it is fixed |
@pmclain, please apply patch from the following PR: |
I'm surprised Klaviyo's stance on the issue is "not our problem" considering the critical level of impact. Pointing your merchants to a possible fix in core Magento with a TBD release while your module cripples checkout is disappointing. |
@pmclain I think klaviyo might introduce the workaround (hack against the issue in the core), but the changes should be similar to what I created - fetch the masked quote using direct queries, but not preventing of re calculation of something. Otherwise, we might see some not clear/random issues |
@ihor-sviziev I don't care what the fix looks like as long as it's fixed. We've already hotfixed this in our instances. It wound up costing a significant drop in conversion since a rolling ~10% of carts were left in a broken state after upgrading from v2 to v3. |
@klaviyojad, that's pretty strong argument for introducing a workaround for this issue inside the klaviyo extension. PS: we had this issue on the cart requests from Klaviyo and it was causing huge cpu on web nodes and db load, but seems like you had it on the frontend, which is more critical |
@pmclain apologies for the back and forth on this issue. We have added the changes to version 3.0.8 to handle it |
Steps to reproduce
All cart interactions below should be done via API
Expected Result
/rest/{{store}}/V1/carts/mine
should return your cart IDActual Result
An infinite loop is triggered when a quote has
quote.coupon_code <> NULL AND quote.trigger_recollect = 1
Summarizing the call stack triggered by this combination:
magento2-klaviyo/Plugin/Api/CartSearchRepository.php
Line 57 in 4e63ccd
https://github.com/magento/magento2/blob/ab815b51dad2a89b120cc53b26eefaee80a336f3/app/code/Magento/Quote/Model/QuoteIdToMaskedQuoteId.php#L53
https://github.com/magento/magento2/blob/ab815b51dad2a89b120cc53b26eefaee80a336f3/app/code/Magento/Quote/Model/QuoteRepository.php#L136
https://github.com/magento/magento2/blob/ab815b51dad2a89b120cc53b26eefaee80a336f3/app/code/Magento/Quote/Model/Quote.php#L2461
☝️ Recollection is triggered here because editing a product in the quote sets
quote.trigger_recollect = 1
During recollection https://github.com/magento/magento2/blob/ab815b51dad2a89b120cc53b26eefaee80a336f3/app/code/Magento/SalesRule/Observer/CouponCodeValidation.php#L66
validates the coupon code. The validation calls
CartRepositoryInterface::getList
which re-triggers your plugin.At this point the request is infinitely looping until it timeouts or exhausts memory.
The text was updated successfully, but these errors were encountered: