今天在现场的哥们发来异常,让我解决,错误信息如下:

复制代码 代码如下:
HTTP Status 500 - Read operation to server 192.168.1.110:20001 failed on database wpdb; nested exception is com.mongodb.MongoException$Network: Read operation to server 192.168.1.110:20001 failed on database wpdb
 
--------------------------------------------------------------------------------
 
type Exception report
 
message Read operation to server 192.168.1.110:20001 failed on database wpdb; nested exception is com.mongodb.MongoException$Network: Read operation to server 192.168.1.110:20001 failed on database wpdb
 
description The server encountered an internal error that prevented it from fulfilling this request.
 
exception
 
org.springframework.dao.DataAccessResourceFailureException: Read operation to server 192.168.1.110:20001 failed on database wpdb; nested exception is com.mongodb.MongoException$Network: Read operation to server 192.168.1.110:20001 failed on database wpdb
    org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:56)
    org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:1913)
    org.springframework.data.mongodb.core.MongoTemplate.executeFindOneInternal(MongoTemplate.java:1743)
    org.springframework.data.mongodb.core.MongoTemplate.doFindOne(MongoTemplate.java:1557)
    org.springframework.data.mongodb.core.MongoTemplate.findOne(MongoTemplate.java:497)
    com.geoway.ime.tile.dao.impl.TileDaoImpl.getTile(TileDaoImpl.java:60)
    com.geoway.ime.tile.service.impl.TileServiceImpl.getTile(TileServiceImpl.java:105)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
    org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    org.springframework.cache.interceptor.CacheInterceptor$1.invoke(CacheInterceptor.java:58)
    org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:211)
    org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:66)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    com.sun.proxy.$Proxy50.getTile(Unknown Source)
    com.geoway.ime.server.rest.TileServer.getTileKVP(TileServer.java:60)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
    com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
    com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
    com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
    com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
    com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
    com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)
    com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
    com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
    com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
    com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
 
 
root cause
 
com.mongodb.MongoException$Network: Read operation to server 192.168.1.110:20001 failed on database wpdb
    com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:308)
    com.mongodb.DBTCPConnector.call(DBTCPConnector.java:279)
    com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:84)
    com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:66)
    com.mongodb.DBCollection.findOne(DBCollection.java:870)
    com.mongodb.DBCollection.findOne(DBCollection.java:844)
    com.mongodb.DBCollection.findOne(DBCollection.java:790)
    org.springframework.data.mongodb.core.MongoTemplate$FindOneCallback.doInCollection(MongoTemplate.java:1980)
    org.springframework.data.mongodb.core.MongoTemplate$FindOneCallback.doInCollection(MongoTemplate.java:1965)
    org.springframework.data.mongodb.core.MongoTemplate.executeFindOneInternal(MongoTemplate.java:1739)
    org.springframework.data.mongodb.core.MongoTemplate.doFindOne(MongoTemplate.java:1557)
    org.springframework.data.mongodb.core.MongoTemplate.findOne(MongoTemplate.java:497)
    com.geoway.ime.tile.dao.impl.TileDaoImpl.getTile(TileDaoImpl.java:60)
    com.geoway.ime.tile.service.impl.TileServiceImpl.getTile(TileServiceImpl.java:105)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
    org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    org.springframework.cache.interceptor.CacheInterceptor$1.invoke(CacheInterceptor.java:58)
    org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:211)
    org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:66)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    com.sun.proxy.$Proxy50.getTile(Unknown Source)
    com.geoway.ime.server.rest.TileServer.getTileKVP(TileServer.java:60)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
    com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
    com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
    com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
    com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
    com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
    com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)
    com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
    com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
    com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
    com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
 
 
root cause
 
java.net.SocketTimeoutException: Read timed out
    java.net.SocketInputStream.socketRead0(Native Method)
    java.net.SocketInputStream.read(SocketInputStream.java:129)
    java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
    java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
    java.io.BufferedInputStream.read(BufferedInputStream.java:317)
    org.bson.io.Bits.readFully(Bits.java:48)
    org.bson.io.Bits.readFully(Bits.java:35)
    org.bson.io.Bits.readFully(Bits.java:30)
    com.mongodb.Response.<init>(Response.java:42)
    com.mongodb.DBPort$1.execute(DBPort.java:141)
    com.mongodb.DBPort$1.execute(DBPort.java:135)
    com.mongodb.DBPort.doOperation(DBPort.java:164)
    com.mongodb.DBPort.call(DBPort.java:135)
    com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:300)
    com.mongodb.DBTCPConnector.call(DBTCPConnector.java:279)
    com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:84)
    com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:66)
    com.mongodb.DBCollection.findOne(DBCollection.java:870)
    com.mongodb.DBCollection.findOne(DBCollection.java:844)
    com.mongodb.DBCollection.findOne(DBCollection.java:790)
    org.springframework.data.mongodb.core.MongoTemplate$FindOneCallback.doInCollection(MongoTemplate.java:1980)
    org.springframework.data.mongodb.core.MongoTemplate$FindOneCallback.doInCollection(MongoTemplate.java:1965)
    org.springframework.data.mongodb.core.MongoTemplate.executeFindOneInternal(MongoTemplate.java:1739)
    org.springframework.data.mongodb.core.MongoTemplate.doFindOne(MongoTemplate.java:1557)
    org.springframework.data.mongodb.core.MongoTemplate.findOne(MongoTemplate.java:497)
    com.geoway.ime.tile.dao.impl.TileDaoImpl.getTile(TileDaoImpl.java:60)
    com.geoway.ime.tile.service.impl.TileServiceImpl.getTile(TileServiceImpl.java:105)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
    org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    org.springframework.cache.interceptor.CacheInterceptor$1.invoke(CacheInterceptor.java:58)
    org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:211)
    org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:66)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    com.sun.proxy.$Proxy50.getTile(Unknown Source)
    com.geoway.ime.server.rest.TileServer.getTileKVP(TileServer.java:60)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
    com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
    com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
    com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
    com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
    com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
    com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)
    com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
    com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
    com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
    com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
 
 
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.41 logs.

由异常来看,是由于MongoDB连接超时造成的。于是,往MongoDB上找原因。首先上MongoDB的配置文件:

复制代码 代码如下:
mongodb.replica-set=192.98.12.242:30007,192.98.12.245:30007
mongodb.hostname=192.98.12.245
mongodb.port=30007
mongodb.connections-per-host=1000
mongodb.threads-allowed-to-block-for-connection-multiplier=200
mongodb.connect-timeout=2000
mongodb.max-wait-time=2000
mongodb.auto-connect-retry=true
mongodb.socket-keep-alive=true
mongodb.socket-timeout=1500
mongodb.slave-ok=true
mongodb.write-number=1
mongodb.write-timeout=1000
mongodb.write-fsync=true
mongodb.dbname=shardvectordb
mongodb.dbuser=
mongodb.dbpassword=

连接时间2秒。然后在定位mongodb的查询,结果为6、7秒。原来是这个原因。然后定位,一个查询为什么耗时那么久呢?

经过排查,原来是查询字段没有创建索引。然后把索引创建,查询几十毫秒,ok问题全部解决。

标签:
MongoDB,查询字段,索引,连接超时异常

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
千金楼资源网 Copyright www.htabc.com

《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线

暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。

艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。

《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。