HCL Commerce Version 9.1.13.0

Troubleshooting: Search gives 500 Internal server error when FacetPageSize is more than 1000

When a large number of attributes are enabled as searchable and the component configuration property FacetPageSize is set to a value above the default of 1000, search queries time out with a 500 internal server error.

Problem

If you have set a large number of attributes to be searchable (for example, 5000 or more), then increasing the component configuration property FacetPageSize to a high value such as 2000, 5000, or 20000 results in a timeout with the message Cannot connect to search server. In this case the default value of 1000 may continue to work, however this may not be the value you need. A more detailed error dump will show something similar to the following, where 5000 attributes are searchable:
2023-06-08T10:08:06.665Z [Default Executor-thread-11] [7242254821593936814] ERROR c.h.c.s.rest.AbstractSearchResource.executeSearch:500 - Failed to perform search:
java.net.SocketTimeoutException: 16,500 milliseconds timeout on connection http-outgoing-0 [ACTIVE]
        at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.timeout(HttpAsyncRequestExecutor.java:387)
        at org.apache.http.impl.nio.client.InternalIODispatch.onTimeout(InternalIODispatch.java:92)
        at org.apache.http.impl.nio.client.InternalIODispatch.onTimeout(InternalIODispatch.java:39)
        at org.apache.http.impl.nio.reactor.AbstractIODispatch.timeout(AbstractIODispatch.java:175)
        at org.apache.http.impl.nio.reactor.BaseIOReactor.sessionTimedOut(BaseIOReactor.java:261)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.timeoutCheck(AbstractIOReactor.java:502)
        at org.apache.http.impl.nio.reactor.BaseIOReactor.validate(BaseIOReactor.java:211)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:280)
        at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
        at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591)

Solution

The search will complete given enough time. You can delay the timeout by adjusting the component configuration property maxTimeAllowed, as described in Component configuration properties. For example, setting maxTimeAllowed to 30000 can permit the search to complete without a timeout message, albeit with a delay.