首页 > 解决方案 > ChannelClosedException - 上游地址:不可用

问题描述

我们的 scala/thrift 服务正在使用带有 java8 的 twitter finagle 2.12-18.10.0。该服务对于单个请求或少数请求运行良好,但是当我们尝试用很多请求访问该服务时,我们会收到很多请求

'com.twitter.finagle.ChannelClosedException: ChannelException at remote address: hostname:9091 from service: calcservice-thrift. Remote Info: Upstream Address: Not Available, Upstream id: Not Available, 
    at org.apache.thrift.TApplicationException.readFrom(TApplicationException.java:131)

命中服务器的示例客户端(间歇性失败)

log.info("started");
     IntStream.range(0,500)
             .parallel()
             .forEach(i->{
                 try {
                     //remote call to finagle service
                 }
                 catch(Exception e){
                     log.error("error " ,e);
                 }
             });
     log.info("end");

为什么服务器会随机关闭频道。可能的解决方法是什么

标签: scalanettyfinagletwitter-finagle

解决方案


推荐阅读