-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
4.5.3
-
None
-
MOODLE_405_STABLE
If a user has more than 65,535 context IDs, a global search with that user is not possible.
If we try with a memory limit of 512 MB, this error always appears when that user attempts a global search:
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 1101824 bytes) in /home/vhosts/moodle/****/public_html/search/engine/simpledb/classes/engine.php on line 184
If we try with memory_limit = 1024M, this error will always appear when this user tries a global search:
Debug-Info: number of parameters must be between 0 and 65535
SELECT * FROM mdl_search_simpledb_index WHERE (owneruserid = $1 OR owneruserid = $2) AND contextid IN (VALUES ,,,,
line 184 of /search/engine/simpledb/classes/engine.php: call to moodle_database->get_records_select()
line 1092 of /search/classes/manager.php: call to search_simpledb\engine->execute_query()
line 979 of /search/classes/manager.php: call to core_search\manager->search()
line 174 of /search/index.php: call to core_search\manager->paged_search()
As a workaround, we use a temporary table to store the context IDs for executing this get_records_select. We believe that chunked execution is also possible.
It also appears that search is experiencing performance issues when retrieving a user's context IDs. Search is very slow - in some cases, it takes several minutes. Could caching user context IDs maybe resolve this issue?