View Issue Details

IDProjectCategoryView StatusLast Update
0024821mantisbtcode cleanuppublic2019-03-16 20:20
Reporterjweberhofer Assigned Tocproensa  
PriorityhighSeveritymajorReproducibilityN/A
Status closedResolutionfixed 
Product Version2.17.1 
Target Version2.20.0Fixed in Version2.20.0 
Summary0024821: Wrong caching in version API
Description

While searching solutions for 0017145 I was reviewing the version_api.php -> version_get_all_rows() function and found a potential issue:

The function can be invoked with filters for $p_released and $p_obsolete as well as an additional query $p_inherit. At the first run everything works fine because data are retrieved via a database query. This result is going to be cached.

Subsequent calls don't re-query the database but will re-use the former result. As this is potentially pre-filtered, the cached result-list will potentially contain not all results and therefore return wrong lists.

I could refactor that, please tell me if you are interested in...

TagsNo tags attached.

Relationships

related to 0017145 feedback Need to show obsolete versions in Change Log. 
related to 0022100 closedcproensa Take care of released/obsolete flag when accessing version_cache_array_rows() cache 

Activities

dregad

dregad

2018-10-04 03:53

developer   ~0060734

Hello,

Thanks for your analysis and bug report. Your contribution would be appreciated, please feel free to submit a pull request on GitHub.

Cheers

Related Changesets

MantisBT: master 46c77ace

2019-02-11 14:35

cproensa

Committer: vboctor


Details Diff
Rewrite project versions cache

Rewrite `version_get_all_rows` so it doesn't perform db queries and rely
in `version_cache_array_rows`.

Rewrite `version_cache_array_rows`to clean up code and improve caching
for non existant projects (eg, ALL_PROJECTS), or projects with no
versions.

Both changes fixes
- A recurrent cache miss when ALL_PROJECT was part of the inheritance
projects scope in a query for versions for a project.
- A potentially wrong cached response for project versions (see 0024821).

Fixes: 0023245, 0024821
Affected Issues
0023245, 0024821, 0025661
mod - core/bug_group_action_api.php Diff File
mod - core/version_api.php Diff File