Bug 462305

Summary: I can't edit components in bugzilla
Product: [Community] Bugzilla Reporter: Martin Stransky <stransky>
Component: AdministrationAssignee: David Lawrence <dkl>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: 3.2CC: dkl
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-01-14 04:38:17 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 474289    
Attachments:
Description Flags
Patch to speed up loading of editcomponents.cgi for larger comp lists (v1)
none
Patch to speed up loading of editcomponents.cgi for larger comp lists (v2)
none
Patch to speed up loading of editcomponents.cgi for larger comp lists (v3)
none
v4 patch to display loginnames correctly in editcomponents.cgi
none
Patch to speed up loading of editcomponents.cgi for larger comp lists (v4)
nelhawar: review+
Patch to speed up loading of editcomponents.cgi for larger comp lists (v5) dkl: review+

Description Martin Stransky 2008-09-15 09:14:09 UTC
Description of problem:

I get when I want to edit components in bugzilla. (I get proxy error).


How reproducible:
Always

Steps to Reproduce:

Administration -> Product -> Fedora -> Edit components -> Proxy error
  
or https://bugzilla.redhat.com/editproducts.cgi?action=edit&product=Fedora&classification=Fedora

Comment 1 David Lawrence 2008-11-21 21:11:22 UTC
Just tried to reverify that this is still occurring after the performance issues with Bugzilla had been fixed and this still occurs:

Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /editcomponents.cgi.

Reason: Error reading from remote server

Basically due to the large number of components in Bugzilla for Fedora, and the way editcomponents.cgi loads them from the database, the proxy is timing out before the editcomponents.cgi page is finished loading. We will need to investigate how to speed up the load time of this page and others products with large component numbers as well.

Comment 2 David Lawrence 2009-01-09 22:42:54 UTC
Created attachment 328599 [details]
Patch to speed up loading of editcomponents.cgi for larger comp lists (v1)

Hey Noura. Attaching a patch to speed up the loading of the editcomponents.cgi by hitting the database directly. The way the upstream has it using objects for everything is a large speed decrease with the amount of components we are using for some of our products. Also in admin/components/list.html.tmpl they are creating even more memory use by creating an override data structure for replacing userids with login_names which I am bypassing. It is a significant increase in speed without change in UI.

Let me know what you think.
Dave

Comment 3 David Lawrence 2009-01-11 22:57:26 UTC
Created attachment 328683 [details]
Patch to speed up loading of editcomponents.cgi for larger comp lists (v2)

Needed to add a trick_taint($product_name) before the SQL call.

Dave

Comment 4 Noura El hawary 2009-01-12 13:34:35 UTC
Comment on attachment 328683 [details]
Patch to speed up loading of editcomponents.cgi for larger comp lists (v2)

Hey Dave,

Patch looks good, only one thing, it is actually not working properly for components that has no qa_contact i believe this issue is coming from the query

>Index: editcomponents.cgi
>===================================================================

>+
>+    $query .= ", products, profiles devel, profiles qa " .
>+              "WHERE components.product_id = products.id AND products.name = ? " .
>+              "AND components.initialowner = devel.userid " .
>+              "AND components.initialqacontact = qa.userid ";
>+

Not all components have initialqacontact so the condition 
"AND components.initialqacontact = qa.userid " will not be met in that case. Also we need to handle this in the display so we display an empty box for undefined qa_contacts

Thanks,
Noura

Comment 5 David Lawrence 2009-01-12 17:14:40 UTC
Created attachment 328765 [details]
Patch to speed up loading of editcomponents.cgi for larger comp lists (v3)

Thanks for the review Noura. I have updated editcomponents.cgi to account for null qa contacts and works better now.

Please review
Dave

Comment 6 Noura El hawary 2009-01-13 09:33:53 UTC
Created attachment 328850 [details]
v4 patch to display loginnames correctly in editcomponents.cgi

Hey Dave,

I did another test for the patch, the previous issue with the null qa_contacts now is fixed, but i found another issue with the display of the login names of the default assignee and qa contact in the editcomponents.cgi, so basically if the page was loaded with no action then it displays fine but if it was loaded after add/delete/update action of a component then the loginnames will display Bugzilla::User hash, that is because default_assignee and default_qa_contact they actually return user object, so one solution i thought of was to add new accessor function to Bugzilla::Component that will return the login name of the qacontact and the assignee of the component and then i fixed your sql accordingly and fixed the name in the template as well this solution seems to work fine, attached is a patch, but i don't know maybe you have better solution. 

Thanks,
Noura

Comment 7 David Lawrence 2009-01-13 21:54:06 UTC
Created attachment 328920 [details]
Patch to speed up loading of editcomponents.cgi for larger comp lists (v4)

Hey Noura. That won't work cause it still tries to load the entire product object with component objects when a component is changed and the components list is redisplayed. So that would be slow reloading as before the fix.

I mistakenly did not take into account reloading of the components list after an edit as I suspected that a redirect was occurring. When actually it is reloading the components/list.html.tmpl directly instead.

I put the SQL that loads the data into a separate function that is now called from each point in editcomponents.cgi that reloads the component list.

Please let me know what you think.
Dave

Comment 8 Noura El hawary 2009-01-14 01:11:32 UTC
Comment on attachment 328920 [details]
Patch to speed up loading of editcomponents.cgi for larger comp lists (v4)

Hey Dave,

Patch looks good I tested it and it works fine, but to be able to test it i had to make the variables:

$product_name and $showbugcounts global by replacing 'my' with 'our' in their declaration.

Thanks,
Noura

Comment 9 David Lawrence 2009-01-14 04:36:34 UTC
Created attachment 328943 [details]
Patch to speed up loading of editcomponents.cgi for larger comp lists (v5)

Thanks Noura. I need to start doing the httpd restart thing in the future for my testing as I did not see the error. The error is mod_perl related. I have changed the load_product_data() function to take the $product_name and $showbugcounts variables as arguments which will solve the warning.

Rolling over review from previous patch and committing to CVS.

Thanks
Dave