XF 1.5 Out-of-memory errors for certain searches with XenES

llk

Member
We're using XenForo Enhanced Search (1.1.6), and we're very happy with the performance overall. However, some searches are triggering errors like "Fatal Error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes)". Our maximum number of search results is set to 500, and as you can see our memory_limit is 256M. I'd try tweaking those knobs more, but I can't imagine 500 results should consume that much memory under normal circumstances.

What's especially strange is that we've encountered at least one case where searching for two short words like "ab" and "cd" individually causes no problems, but a search for "ab cd" runs out of memory. To me this suggests something is wrong, but I'm not sure what. Suggestions?
 
Search has to load all results and filter them for viability checks, it then saves the IDs so they can be paged through later. You may just need a higher memory limit..

Are you using php 7.x? This would cut your memory usage significantly.
 
I don't believe that XFES loads ALL search results first, before filtering. That would be insane. My understanding is it first fetches up to maximumSearchResults number of results from Elasticsearch, then filters those further based on visibility.

It doesn't make sense that only 500 results could consume anywhere near that much memory, even accounting for what XF takes up normally (we previously ran with memory_limit at 64M, with no problems outside of search). It also doesn't make sense that searches for "ab" and "cd" would be fine, but "ab cd" would result in an out-of-memory error.
 
Back
Top Bottom