• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed Outrageous Memory Usage for Resources with Many Watchers

md_5

Well-known member
#1
Similar to https://xenforo.com/community/threads/unable-to-moderate-downloads-with-many-subscribers.69640/ but not quite.

We have a few very popular resources, including the largest one which currently has 28,416 watchers. Unfortunately whenever the author tries to post an update to this resource, he causes PHP to run out of memory.

Originally a memory limit of 128M was fine to run XenForo. It is currently 384M and I am now about to increase it to 512M in the hopes that I can keep the issue at bay for a few months until a fix is released....
 

Mike

XenForo developer
Staff member
#2
What error do you get specifically?

I would suggest that is effectively the same issue (which probably applies to threads as well).
 

md_5

Well-known member
#3
What error do you get specifically?

I would suggest that is effectively the same issue (which probably applies to threads as well).
The XenForo error log stack trace was useless, only two deep (just ::handleException)
 

md_5

Well-known member
#5
That may be true, but what was the error specifically?
Code:
ErrorException: Fatal Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 18906272 bytes) - library/Zend/Db/Statement/Mysqli.php:250
Generated By: md_5, A moment ago
Stack Trace

#0 [internal function]: XenForo_Application::handleFatalError()
#1 {main}

As I said, useless.

Had to go and bump down the memory limit to trigger it (was 512M)
 

Slind

Active member
#6
We ran into this or a similar issue with subscribed forums, the only we can create threads in those areas is by creating them somewhere else and moving them afterwards.
 

Xon

Well-known member
#7
This is a design flaw where the entire user record (and options, and preferences) is loaded for every user who has watched something.

I believe XenForo can dramatically limit the size of the data by removing a bunch of "<table>.*" from the queries to only fetch just the required data. Ideally there would be a hook to inject additional select clauses for add-ons.

The other (better)alternative is to push the notification stuff into a deferred task which alerts users in chunks.