【ElasticSearch】异常记录
=======================================================================
1、Request cannot be executed; I/O reactor status: STOPPED
2、max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
3、whose UTF8 encoding is longer than the max length 32766
=======================================================================
1、Request cannot be executed; I/O reactor status: STOPPED
Caused by: java.lang.RuntimeException: Request cannot be executed; I/O reactor status: STOPPED at org.elasticsearch.client.RestClient.extractAndWrapCause(RestClient.java:857) at org.elasticsearch.client.RestClient.performRequest(RestClient.java:259) at org.elasticsearch.client.RestClient.performRequest(RestClient.java:246) at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1613) at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1583) at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1553) at org.elasticsearch.client.RestHighLevelClient.search(RestHighLevelClient.java:1069) at com.deyatech.esutil.service.impl.ElasticSearchServiceImpl.selectDataByESQueryJSON(ElasticSearchServiceImpl.java:581) at com.deyatech.esutil.service.impl.ElasticSearchServiceImpl.searchData(ElasticSearchServiceImpl.java:548) at com.deyatech.reception.service.impl.InfoTemplateEsServiceImpl.getElaticsearchResult(InfoTemplateEsServiceImpl.java:251) at com.deyatech.reception.service.impl.InfoTemplateEsServiceImpl.getTemplateListView(InfoTemplateEsServiceImpl.java:120) at com.deyatech.reception.service.impl.InfoTemplateServiceImpl.getTemplateListView(InfoTemplateServiceImpl.java:221) at com.deyatech.reception.service.impl.InfoTemplateServiceImpl$$FastClassBySpringCGLIB$$aadf779.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) at org.springframework.cache.interceptor.CacheInterceptor.lambda$invoke$0(CacheInterceptor.java:53) at org.springframework.cache.interceptor.CacheAspectSupport.invokeOperation(CacheAspectSupport.java:366) at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:421) at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:346) at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:61) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691) at com.deyatech.reception.service.impl.InfoTemplateServiceImpl$$EnhancerBySpringCGLIB$$6d755bd7.getTemplateListView(<generated>) at com.deyatech.reception.thymeleaf.InfoDataExpressionObject.getInfoList(InfoDataExpressionObject.java:47) at sun.reflect.GeneratedMethodAccessor1001.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:902) at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1547) ... 113 common frames omitted Caused by: java.lang.IllegalStateException: Request cannot be executed; I/O reactor status: STOPPED at org.apache.http.util.Asserts.check(Asserts.java:46) at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase.ensureRunning(CloseableHttpAsyncClientBase.java:90) at org.apache.http.impl.nio.client.InternalHttpAsyncClient.execute(InternalHttpAsyncClient.java:123) at org.elasticsearch.client.RestClient.performRequest(RestClient.java:255) ... 143 common frames omitted
github已提的问题
https://github.com/elastic/elasticsearch/issues/42133
https://github.com/elastic/elasticsearch/issues/45115
https://github.com/elastic/elasticsearch/issues/49124
https://github.com/elastic/elasticsearch/issues/39946
一些可以尝试的方法来解决问题
After some debugging and configuration tuning, I found that the exception was caused by too many concurrent ElasticSearch clients. After I reduce the number of concurrent clients, the exception is gone.
减少客户端的数量,使用的地方都注入。
I'm using the client at scheduled method, so every invocation is started in new thread. The client has been injected to the service and never closed. Seems that is the reason of exception in my case. I changed my implementation so a new client is created at every thread when it is needed and closes in the end of method. That fixed the issue.
每次使用都新创建客户端,用完后关闭。
自己构建 RestHighLevelClient 使用 HttpComponents,链接STOP时重新构造客户端
2、max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
vi /etc/sysctl.conf
# 添加 一行
vm.max_map_count=655360
# 加载参数
sysctl -p
3、whose UTF8 encoding is longer than the max length 32766
Document contains at least one immense term in field=\"summary\" (whose UTF8 encoding is longer than the max length 32766), all of which were skipped. Please correct the analyzer to not produce such terms. The prefix of the first immense term is: '[56, -26, -100, -120, 50, 54, -26, -105, -91, -17, -68, -116, -28, -71, -96, -24, -65, -111, -27, -71, -77, -26, -128, -69, -28, -71, -90, -24, -82, -80]...'
summary时keyword类型,长度超了可以忽略超过的部分
PUT myindex/_mapping
{
"properties": {
"summary": {
"type": "keyword",
"ignore_above": 10000
}
}
}
终端
curl -XPOST http://localhost:9200/myindex/_mapping -H 'Content-Type:application/json' -d '
{
"properties": {
"summary": {
"type": "keyword",
"ignore_above": 10000
}
}
}
'
4、Trying to create too many buckets. Must be less than or equal to: [65536] but was [65537]. This limit can be set by changing the [search.max_buckets] cluster level setting.
修改最大桶数
PUT /_cluster/settings
{
"persistent" : {
"search.max_buckets" : 99999
}
}
查看配置
GET _cluster/settings
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· PowerShell开发游戏 · 打蜜蜂
· 在鹅厂做java开发是什么体验
· 百万级群聊的设计实践
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战
· 永远不要相信用户的输入:从 SQL 注入攻防看输入验证的重要性