There is timeouts in function _acidfree_parent_select if there is >150 albums on album contents page.

Timeouts - I mean executions take too many time (4-5 min) and webserver gives '504' error. Also there is a lot of SELECT requests to SQL server.

A reason - _acidfree_parent_select called 4 times on this page.
Also _acidfree_parent_select called on Edit page.

I made patch for it for caching parent album tree. Works fine for me. See attached file.

And a question for developers.
As I understood, _acidfree_parent_select is called only for site root, isn't it ?
If it also called for per-user albooms with different $root, my caching code has to be rewritten due to security issues.

Comments

vhmauery’s picture

Status: Active » Needs review
StatusFileSize
new1009 bytes

Here is a more concise caching patch. Test it out and let me know if it works for you.

vhmauery’s picture

StatusFileSize
new1.08 KB

hmmm. a little too hasty. here is a patch that caches all trees that are requested. acidfree_get_album_tree is mostly called with root, but in the case of albums, it is called on the album as well so you can't select a sub-album as the parent for an album.

This one should work better.

vhmauery’s picture

Status: Needs review » Closed (won't fix)

I am going to close this because 1) this is the only reported instance of this bug, 2) a patch is available to fix the problem, and 3) I really only have time to do security fixes for 4.7.

apotek’s picture

I know this is closed, but am just tacking on my experience: used the patch, but am still getting timeouts (nor did it help me quit smoking). With over 40,000 users, it just looks like acidfree is not the right direction to go. So, like the author says, if you only expect to be dealing with album counts in the hundreds, acidfree will probably work well for you, but it looks like any heavier use is not recommended. Hope I can save someone else with a large site some frustration. Cheers.

vhmauery’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev
Status: Closed (won't fix) » Active

It appears that there is some more that we can do. I had a conversation with Fabio, the video module maintainer and he wrote some code that does the correct filtering in the DB rather than in php, so Acidfree should scale better. However, I have not worked this into Acidfree yet.

Also please note that Acidfree-4.7 will not get this fix, but Acidfree-5 will. And don't ask me to backport it because I CAN'T. The two differ so much in this area that I would not even bother to find another work-around. Because of this, I have marked this issue as a 5.x-dev issue.

apotek’s picture

I had a conversation with Fabio, the video module maintainer and he wrote some code that does the correct filtering in the DB rather than in php, so Acidfree should scale better. However, I have not worked this into Acidfree yet.

If I could see Fabio's code, I could probably port it over to 4.7, and then it would be somewhat easy to update it for 5.

mwheinz’s picture

Status: Active » Closed (won't fix)

Closing. 3 years of no activity.