$ drush @ks.local cc all

PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 523800 bytes) in /Users/jucallme/Sites/systemseed/ks_profile/new/build/includes/database/query.inc on line 1090

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 523800 bytes) in /Users/jucallme/Sites/systemseed/ks_profile/new/build/includes/database/query.inc on line 1090

This happened after enabling and adding a new coupon (see screen shot) http://cl.ly/012Z0z1h0y3s0P2k2f0P

Comments

roam2345’s picture

Issue summary: View changes

cross ref

roam2345’s picture

Issue summary: View changes

ad screen shot

roam2345’s picture

Priority: Normal » Critical

PS: you can't get the site back once this has happened, upgrading priority.

pcambra’s picture

Status: Active » Postponed (maintainer needs more info)

This definitely doesn't happen in my enviroment, could you specify the steps to reproduce it?

roam2345’s picture

1. install this module (i used check from git).
2. add a fixed price coupon.
3. run drush cc all

you have the error.

roam2345’s picture

Status: Postponed (maintainer needs more info) » Active

change status

pcambra’s picture

Status: Active » Postponed (maintainer needs more info)

1. install this module (i used check from git).
2. add a fixed price coupon.
3. run drush cc all

macbook-de-pedro-cambra-2:commerce_coupon pcambra$ drush cc all

'all' cache was cleared                                               [success]
mrfelton’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new1.38 KB

Same problem for me too. Seems that the call to entity_metadata_wrapper() in commerce_coupon_fixed_amount_commerce_price_component_type_info was causing a heavily recursive loop, with commerce_coupon_fixed_amount_commerce_price_component_type_info being called over and over again, resulting to a memory overflow on our system. Attached patch reworks to achieve the same thing, without using entity_metadata_wrapper().

Reminds me of the problem I had trying to do stuff that I really cant do in a commerce _info hook. #1509450: Unable to load current order from hook_commerce_checkout_page_info_alter

Not sure how it worked for you @pcambra, but perhaps there is a finite limit to the amount of looping that happens, which on your system wasn't an issue. Try chucking a dd statement at the top of commerce_coupon_fixed_amount_commerce_price_component_type_info and see how many times it gets called.

pcambra’s picture

Status: Needs review » Needs work

Not sure of the environment conditions as I've just installed a kickstart with coupon and can't reproduce this.

About the patch, I'd say that these are not quite the same.

  'coupon_code' => $coupon_wrapper->commerce_coupon_code->value(),
      'coupon_code' => $wrapper->coupon[LANGUAGE_NONE][0]['value'],

Maybe we could use something like this
$items = field_get_items('commerce_coupon', 'commerce_coupon_fixed', 'commerce_coupon_code');

Anyways let's see the feedback by jucallme

pcambra’s picture

Just seen that field_get_items conflicts with entity and rules at this point, we can gather the info manually, but it would be a little less fancy :)

mrfelton’s picture

Status: Needs work » Needs review
StatusFileSize
new1.4 KB

Yeah, there was an issue with the previous patch. I think this ons better.

roam2345’s picture

Yup patch solves issue @pcambra

pcambra’s picture

Status: Needs review » Fixed

Great, let's commit the code which is actually the same but without wrappers, thanks mrfelton & jucallme!

Also committed to commerce coupon percentage that shares this code atm.

roam2345’s picture

Status: Fixed » Active

Nope now that the % bit is using this its blowing up for me.......

pcambra’s picture

Now both share the code in this patch, are you sure you've updated to the last git version?

roam2345’s picture

Status: Active » Fixed

there was some change that i missed in commerce_coupon_pct.module

works :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

remove other issue