View Issue Details

IDProjectCategoryView StatusLast Update
0015411mantisbtperformancepublic2014-09-23 18:05
Reporterdregad 
Assigned Todregad 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.13 
Target Version1.2.14Fixed in Version1.2.14 
Summary0015411: Huge memory consumption for print_user_option_list()
Description

Following the implementation of the fix for 0010130, calling this function when the current project is ALL_PROJECTS causes a massive surge in memory usage, due to repeated calls to array_merge() as the code builds a very large array containing the list of all users in all projects accessible to the current user, and then reduces it to remove duplicates.

The code must be optimized to reduce memory consumption.

Additional Information

With about 21000 records in the user table, the memory footprint of calling this function for all projects is as follows:

  • in 1.2.12: ~150M
  • in 1.2.13: ~650M (!)
TagsNo tags attached.

Relationships

related to 0010130 closeddregad Filter "Assigned to" does not display usernames when project "All Projects" is selected 
related to 0015721 closedgrangeway Functionality to consider porting to master-2.0.x 
has duplicate 0015347 closeddregad Bad performance and memory issue with print_user_option_list 
related to 0012677 acknowledged Please change a search option to manage users 
related to 0017490 closeddregad Click Manage Configuration produces blank page 

Activities

dregad

dregad

2013-01-24 03:25

developer   ~0034884

With the attached commit, memory usage is reduced to approx 180M.

I dont see how it can be further reduced. As mentioned on the mailing list [1], I believe that in the future we should refactor the way we deal with user
selection lists, maybe by switching to an ajax-based user entry text field
with autocomplete, along the lines of what was proposed by Daryn in 0012677.

[1] http://thread.gmane.org/gmane.comp.bug-tracking.mantis.devel/4230/focus=4245

grangeway

grangeway

2013-04-05 17:56

reporter   ~0036103

Marking as acknowledged not resolved/closed to track that change gets ported to master-2.0.x branch

Related Changesets

MantisBT: master-1.2.x e61e63ca

2013-01-23 01:26:50

dregad

Details Diff
Fix huge memory consumption for print_user_option_list()

Following the implementation of the fix for 0010130, calling this
function when the current project is ALL_PROJECTS causes a massive surge
in memory usage as the code builds a large array containing the list of
all users in all projects accessible to the current user, and then
reduces it to remove duplicates.

This commit reduces the problem by removing calls to array_merge() and
building the consolidated user list in a single pass, using a while
loop. No-longer-used arrays are unset to free up memory.

Fixes 0015411
mod - core/print_api.php Diff File

MantisBT: master f977b3ca

2013-01-23 01:26:50

dregad

Details Diff
Fix huge memory consumption for print_user_option_list()

Following the implementation of the fix for 0010130, calling this
function when the current project is ALL_PROJECTS causes a massive surge
in memory usage as the code builds a large array containing the list of
all users in all projects accessible to the current user, and then
reduces it to remove duplicates.

This commit reduces the problem by removing calls to array_merge() and
building the consolidated user list in a single pass, using a while
loop. No-longer-used arrays are unset to free up memory.

Fixes 0015411
mod - core/print_api.php Diff File

Issue History

Date Modified Username Field Change
2013-01-22 20:14 dregad New Issue
2013-01-22 20:14 dregad Status new => assigned
2013-01-22 20:14 dregad Assigned To => dregad
2013-01-22 20:15 dregad Relationship added related to 0010130
2013-01-22 20:38 dregad Changeset attached => MantisBT master-1.2.x e61e63ca
2013-01-22 20:38 dregad Status assigned => resolved
2013-01-22 20:38 dregad Resolution open => fixed
2013-01-22 20:38 dregad Fixed in Version => 1.2.14
2013-01-22 20:41 dregad Relationship added has duplicate 0015347
2013-01-24 03:03 dregad Changeset attached => MantisBT master f977b3ca
2013-01-24 03:25 dregad Note Added: 0034884
2013-01-24 03:35 dregad Relationship added related to 0012677
2013-01-29 09:25 dregad Status resolved => closed
2013-04-05 17:56 grangeway Status closed => acknowledged
2013-04-05 17:56 grangeway Note Added: 0036103
2013-04-05 19:34 grangeway Relationship added related to 0015721
2013-04-06 03:38 dregad Status acknowledged => closed
2013-04-06 07:23 grangeway Status closed => acknowledged
2013-04-06 09:22 dregad Tag Attached: 2.0.x check
2013-04-06 09:23 dregad Status acknowledged => closed
2014-07-07 08:15 dregad Relationship added related to 0017490
2014-09-23 18:05 grangeway Tag Detached: 2.0.x check