View Issue Details

IDProjectCategoryView StatusLast Update
0018016mantisbtperformancepublic2016-06-12 00:42
Reporterjhelf Assigned Tocproensa  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.2.18 
Target Version1.3.0-rc.2Fixed in Version1.3.0-rc.2 
Summary0018016: Decreasing performance when loading bug view with many notes
Description

When being logged in with an administrator user and repeatedly loading a bug with many notes the response times get perceivably worse over time.

This is probably related to issue 0013680 and already explained by note 0013680:0031981 but there seems to be no overall fix.

Steps To Reproduce

Initial situation:

I installed the stable 1.2.18 release with an existing database. Upgrade procedure was performed as documented. I don't think its an issue with the current release though, seems to be a general problem.

Way to reproduce:

  • Ensure form_security_validation is on
  • Login with an administrator account or similar rights.
  • Navigate to an issue with many notes (Because of the user permissions one should see 3 buttons at every note)
  • Keep reloading the page and watch the request times increase
Additional Information

The note buttons are rendered by the function print_button. print_button calls form_security_field which calls form_security_token where security tokens are generated and stored into the session.

In bugnote_view_inc.php print_button is called without a $p_security_token argument which forces a new token to be generated by every call to print_button.

Every single token is stored into the session. The session grows and grows with every call to print_button and the (de)serialization CPU drain increases proportional.

Login/Logout "cures" the Problem because a new session is generated.

TagsNo tags attached.

Relationships

related to 0020142 closedcommunity performance loading bug view with many attachments 

Activities

dregad

dregad

2015-01-14 11:16

developer   ~0042154

Many thanks for the bug report and the detailed analysis.

I'll investigate as time allows and see if a similar fix can be applied to bug view page.

cproensa

cproensa

2015-09-26 20:27

developer   ~0051541

Can confirm
In my system i have some issues with >100 notes !!
Exactly as described by jhelf.

Proposed PR: https://github.com/mantisbt/mantisbt/pull/656

gthomas

gthomas

2016-02-19 07:38

reporter   ~0052527

Last edited: 2016-02-19 18:49

I can confirm the same for issues with more than 300 notes (610 is the biggest).

@cproensa 's PR 656 is just greate (cherry-picked the first 3 commits).

[EDIT dregad] removed # in front of PR number

Related Changesets

MantisBT: master 63329426

2015-09-26 16:04

cproensa

Committer: dregad


Details Diff
Pre-generate form security tokens

Avoid performance issues in bug view page

Fixes 0018016
Affected Issues
0018016
mod - bugnote_view_inc.php Diff File

MantisBT: master f3555c30

2015-09-27 11:03

cproensa

Committer: dregad


Details Diff
Create tokens for action buttons only if needed

Issue 0018016
Affected Issues
0018016
mod - bugnote_view_inc.php Diff File

MantisBT: master 9e532d6b

2016-03-06 12:45

cproensa

Committer: dregad


Details Diff
Dont use serialization for Session variables

There is no need to serialize data inserted in $_SESSION, as php does it
at the end of script

This is a performance hit when a session key is used multiple times (eg:
'form_security_tokens')

Additionally, we use a new identifier for the session key (by adding a
version number to it). Since we changed the format of the stored data,
this will ignore older session data to avoid errors for users having
active sessions during the transition.

Fixes 0020142, 0018016

Signed-off-by: Damien Regad <dregad@mantisbt.org>

Squashed original commits and reworded commit message
Affected Issues
0018016, 0020142
mod - core/session_api.php Diff File