Skip to content
This repository has been archived by the owner on Mar 17, 2020. It is now read-only.

Memory Exhausted #5

Open
transitguru opened this issue Feb 25, 2015 · 2 comments
Open

Memory Exhausted #5

transitguru opened this issue Feb 25, 2015 · 2 comments

Comments

@transitguru
Copy link

@shaabans noted:

Many users are getting an error that looks just like this:

http://forge.prestashop.com/browse/PNM-2641

The "fix" at the bottom of that thread has been tested and works. We're still unable to consistently recreate the error. A scenario that causes this 100% of the time would be very helpful, we're working on this now!

@alex974 replied:

I registered an account because i have wait too much bug with this module and i wanted to report them to help
Regarding this error , like your link find out , the problem come from the setDiscount of the getTax method in Avalaratax.php.

The real problem has nothing to do with the memory,if you debug it , you realize very quickly that it's just an infinite loop . You are in Gettax() , here setdiscount call the following
$params['cart']->getOrderTotal(true, Cart::ONLY_DISCOUNTS)); And somehow after going to a lot and lot of code getOrderTotal do call Gettax() again.

Very shortly that give , gettax()->getOrderTotal()->gettax()->getOrderTotal->gettax() until yea you run out of memory eventually .

I will try to provide a scenario i do have some order that hit 100% this errors.

@richardbakerparis
Copy link
Contributor

#3
Change to line 1135.
If cart doesn't exist, set discount to 0.00.

@transitguru
Copy link
Author

The issue doesn't seem to be the problem of whether the cart exists, but when there is any sort of discount applied in Price Rules > Cart Rules. Set it to a 10% discount as a global rule and the memory leak occurs. This occurs wheter the patch above is applied or not. If the discount does not apply to the cart, the infinite loop would not occur. If it does, white screen and a nice message on your error log regarding memory overflow.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants