XF 2.2 Getting errors similar to "ErrorException:Fatal Error:Allowed memory size of 1073741824 bytes exhausted(tried to allocate 2621440 bytes)" every moment

Xon

Well-known member
@Simplilearn you can try setting $config['jobMaxRunTime'] = 2; (or shorter!) in config.php

The permission rebuild job loads too much data at once so by making it work for less per cycle it should avoid out of control memory usage.

Or if you are willing to patch XF code (or replace via add-ons), You can also patch XF\Job\PermissionRebuild to add a limit to this query:
PHP:
$combinationIds = $db->fetchAllColumn("
   SELECT permission_combination_id
   FROM xf_permission_combination
   WHERE permission_combination_id > ?
   ORDER BY permission_combination_id
", $this->data['combinationId']);
Change to;
PHP:
$combinationIds = $db->fetchAllColumn("
   SELECT permission_combination_id
   FROM xf_permission_combination
   WHERE permission_combination_id > ?
   ORDER BY permission_combination_id
   LIMIT 2000
", $this->data['combinationId']);

This will hard limit how much work the job does per iteration which will be more reliable than the config setting.

If we have a user group per private forum it will be more user groups right. Is there any other way?
1. What will happen if we stop refreshing cache from API?
2. If we are not refreshed the cache when it will refresh automatically?
3. Can we use an external cache like Redis?
4. What is the default cache in xenforo?
1. permission just don't work, the cache is what is used during the permission lookup
2. It is automatically managed
3. Caching isn't the issue, XF is loading too much data at once. But I do have an add-on which may be useful: https://atelieraphelion.com/products/cache-permission-checks.89/
4. XenForo works without a cache by default, but supports redis or memcache. Without add-ons this doesn't affect the permission system
 
Top