Hi,

I am trying to build a custom product entity; happyproduct.
I added a couple of fields. These fields will in the future be imported through commerce feeds.
With adding more than 10 fields to the product entiy, somehow the site becomes very slow, the response is not within 45 seconds and this is the error I got:

Premature end of script headers: index.php, referer: admin/commerce/products/types/happyproduct/fields
mod_fcgid: read data timeout in 45 seconds, referer: admin/commerce/products/types/happyproduct/fields 

The only thing I do is trying to add an extra field to the happyproduct product entity, but it is not working, because of the error 500.
If I refresh page, again error 500 after 45 seconds and the field is not added if I come back to the happyproduct, and look into the fields.

I also use the i18n modules, and lots of commerce submodules, but that can't be the problem I think, can it?

greetings and thanks for going into this.
Martijn

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rszrama’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

No clue - I haven't tested the performance of the Field UI. Are you sure this isn't just a Drupal thing? Perhaps try adding 10 fields to a node type and seeing what happens. There's nothing in this code that should be specific to Drupal Commerce itself, but perhaps there's a performance issue in the product reference module's field injection. If there is, I'd have expected us to hit it earlier... we've had sites with many more fields on product types than 10.

We'll need to be able to reproduce the issue on a clean install of Commerce to debug.

Summit’s picture

Status: Postponed (maintainer needs more info) » Active

Hi,

Is there anyway to debug this...? I tried another product entity and again with trying to insert the 11th field again the 500 error with:

 mod_fcgid: read data timeout in 45 seconds, referer: admin/commerce/products/types/pfconceptproduct/fields
Premature end of script headers: index.php, referer: admin/commerce/products/types/pfconceptproduct/fields

greetings, Martijn

Summit’s picture

Hi,
As a workaround I can add the fields programmaticaly: http://realguess.net/node/136, but would love to see solution.
Could it have to do with translateble fields?
Earlier I got errors and added this patch, after that the problems started: //http://drupal.org/node/951098
greetings, Martijn

Summit’s picture

Hi,
I removed: Commerce (bulk product creation), and now I got performance again. Can this module be the problem?
Greetings, Martijn

rszrama’s picture

Project: Commerce Core » Commerce Bulk Product Creation
Version: 7.x-1.2 » 7.x-1.x-dev
Component: Commerce » Code

It could indeed, though I don't know why that module would be a problem unless you were specifically using its forms. Let's move this issue to its queue.

sven.lauer’s picture

Hm, this is strange. BPC does perform a form_alter on the field settings form, but it only adds one or two form elements ... a hunch: After field creation, BPC rebuilds the menu---could it be that the real culprit is some other module that makes the menu-rebuild die? Though in that case, we would expect that the problem persists. After you tried to add a field ...

Summit’s picture

Hi,
Why does BPC do a form alter? It's purpose is to help with bulk inserting product-entities.
I experct BPC not to do anything to the form if not used...but I am not a programmer.

I only know that when I disabled BPC my problem was gone of more than 45 sec. updating the field setting form. Somehow BPC interfered with the form..
Greetings, Martijn

rszrama’s picture

The form alter isn't on the field overview but an individual field's settings form so that you can enable a field for BPC usage. It's targeted to the individual field form and so shouldn't introduce a performance problem in general usage. Must be something else going on.

Summit’s picture

Hi, With BPC I was not able to come to the individual field settings page...it stayed on the overall page, and then after 45 sec. error 500.
greetings, Martijn

sven.lauer’s picture

Well, but the individual field settings page would have been the next one displayed, so this form_alter could, conceivably, have an effect.

What version fo BPC were you using, exactly?

sven.lauer’s picture

Correction: BPC adds an instance setting, so it does NOT alter the form that is displayed first when adding a new field (but it does alter the one that is displayed first when adding an existing field).

Which makes it even less likely that BPC is the culprit here ...

Summit’s picture

Hi, I only know that after disabling BPC my problem was solved...I will set up testsite and see what happens if I enable BPC again. Will try to get this fixed tomorrow.
EDIT: With enabling BPC again no go, so somehow it must be related..

greetings, Martijn

chasematterhorn’s picture

I had the same issue and also resolved it through disabling BPC.

sven.lauer’s picture

Category: support » bug
Priority: Normal » Major

So this is definitely an issue. Reclassfiying as a bug and raising priority.

sven.lauer’s picture

Hm, I still cannot reproduce the problem, regardless of how many fields I add. I also tried to apply the patch from #951098: tab_root_map and tab_parent_map notices undefined in _menu_translate(), just in case, but this did not create the problem, either.

@chasematterhorn: You did not apply that patch, right? How many fields do your product types have?

mattreba’s picture

Status: Postponed (maintainer needs more info) » Active

Just posting a "me too" on this issue. The 500 errors were PHP timeouts. I was able to "function" by upping the timeout to 3 minutes but as you can imagine waiting 2-3 minutes to add multiple fields to multiple product types gets old quick. I found this, diasabled BPC and was back in business.

(Side note: Product type cloning please. An option to add fields to multiple existing product types in one operation would also be handy and also help with keeping settings consistent where appropriate between product types.)

sven.lauer’s picture

Status: Active » Postponed (maintainer needs more info)

I still cannot reproduce this, sadly.

BUT: We do know that the problem must have something to do with the menu rebuild. BPC was doing a menu_rebuild() on instance creation, which MIGHT (though I don't quite see how) have triggered multiple rebuilds of the menu, leading to the time-out. I just committed a fix that delays the rebuild till the next page load (as commerce core does it since #1574746: Replace menu_rebuild() with variable_set('menu_rebuild_needed', TRUE) for better performance)---so this MIGHT solve the issue.

It would be great if someone who had the issue could try updating to the latest 7.x-1.x-dev version once it is rolled and see if the problem is solved.

mp’s picture

Status: Active » Postponed (maintainer needs more info)
davidwhthomas’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Priority: Major » Normal
Status: Postponed (maintainer needs more info) » Needs review
FileSize
1.73 KB

I came across this issue. During debug I found menu_rebuild() was being called for every field instance when a product type was saved.

I see there's a patch to 7.x-2.x that uses variable_set('menu_rebuild_needed', TRUE); instead.

That's better, however variable_set is still called multiple times per page load, flushing and rebuilding the entire variable cache uneccessarily.

The attached patch uses a static variable to check whether the variable hasn't already been set, prior to setting and requesting a menu_rebuild.