[技术交流] io.vertx.core.VertxException: Connection was closed 可能原因


在做超时测试的时候,发现抛出如下异常:

2018-12-06 16:12:02,005 [ERROR] invoke failed, invocation=CONSUMER rest AutoProvider.serverMvc.SayHello org.apache.servicecomb.swagger.invocation.exception.DefaultExceptionToProducerResponseConverter.convert(DefaultExceptionToProducerResponseConverter.java:35)
io.vertx.core.VertxException: Connection was closed
2018-12-06 16:12:02,005 [WARN] bizkeeper command CONSUMER rest AutoProvider.serverMvc.SayHello failed due to InvocationException: code=490;msg=CommonExceptionData [message=Cse Internal Bad Request] org.apache.servicecomb.bizkeeper.BizkeeperCommand.lambda$null$1(BizkeeperCommand.java:82)
2018-12-06 16:12:02,005 [WARN] bizkeeper execution error, info=cause:InvocationException,message:InvocationException: code=490;msg=CommonExceptionData [message=Cse Internal Bad Request];cause:VertxException,message:Connection was closed org.apache.servicecomb.bizkeeper.BizkeeperHandler$1.onExecutionError(BizkeeperHandler.java:55)
2018-12-06 16:12:02,006 [WARN] catch error in bizkeeper:Consumer.AutoProvider.serverMvc.SayHello failed and fallback disabled. org.apache.servicecomb.bizkeeper.BizkeeperHandler.lambda$handle$0(BizkeeperHandler.java:79)

预期是客户端得到超时异常,但是实际捕获到了Connection was closed异常。 


最后检查是服务端配置了如下配置项:

servicecomb.rest.server.connection.idleTimeoutInSeconds = 1


由于服务端设置了连接限制时间,关闭了连接。 当处理时间超过1秒的时候,就会出现这个异常了。