You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2020/07/14 05:48:11 UTC

[GitHub] [servicecomb-pack] 515445681 opened a new issue #671: 接收端抛出Failed to get reconnected sender, all alpha server is down.异常

515445681 opened a new issue #671:
URL: https://github.com/apache/servicecomb-pack/issues/671


   项目通过SpringCloud的Feign进行调用,A项目调用B项目,在B项目中的Controller中可以拿到X-Pack-Global-Transaction-Id。
   
   但是B中的Controller调用service方法时,抛出异常。
   
   header如下:
   
   ```
   X-Pack-Local-Transaction-Id:bb67b63a-a75f-4f7e-925c-4097c96173ba
   Accept:*/*
   Connection:Keep-Alive
   User-Agent:Apache-HttpClient/4.5.8 (Java/1.8.0_171)
   X-Forwarded-For:192.168.72.128
   X-Pack-Global-Transaction-Id:bb67b63a-a75f-4f7e-925c-4097c96173ba
   
   ```
   
   B项目service代码如下:
   
   ```
       @Compensable(compensationMethod = "cancel")
       public List selectAllArea(String id) {
           return list;
       }
   
       public void cancel(String id){
           System.out.println(111);
       }
   ```
   
   异常如下:
   
   ```
   org.apache.servicecomb.pack.omega.transaction.OmegaException: Failed to get reconnected sender, all alpha server is down.
   	at org.apache.servicecomb.pack.omega.connector.grpc.core.GrpcOnErrorHandler$GrpcRetryContext$1.get(GrpcOnErrorHandler.java:73)
   	at org.apache.servicecomb.pack.omega.connector.grpc.core.GrpcOnErrorHandler$GrpcRetryContext$1.get(GrpcOnErrorHandler.java:67)
   	at org.apache.servicecomb.pack.omega.connector.grpc.core.FastestSender.pick(FastestSender.java:39)
   	at org.apache.servicecomb.pack.omega.connector.grpc.core.LoadBalanceSenderAdapter.pickMessageSender(LoadBalanceSenderAdapter.java:46)
   	at org.apache.servicecomb.pack.omega.connector.grpc.saga.SagaLoadBalanceSender.send(SagaLoadBalanceSender.java:41)
   	at org.apache.servicecomb.pack.omega.transaction.CompensableInterceptor.preIntercept(CompensableInterceptor.java:34)
   	at org.apache.servicecomb.pack.omega.transaction.DefaultRecovery.applyTo(DefaultRecovery.java:59)
   	at org.apache.servicecomb.pack.omega.transaction.AbstractRecoveryPolicy.apply(AbstractRecoveryPolicy.java:40)
   	at org.apache.servicecomb.pack.omega.transaction.TransactionAspect.advise(TransactionAspect.java:66)
   	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
   	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
   	at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
   	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
   	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
   ```
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-pack] coolbeevip commented on issue #671: 接收端抛出Failed to get reconnected sender, all alpha server is down.或 空指针 异常

Posted by GitBox <gi...@apache.org>.
coolbeevip commented on issue #671:
URL: https://github.com/apache/servicecomb-pack/issues/671#issuecomment-657991000


   > @coolbeevip 我改成apache http client了。是不是跟这个有关系。但是我B端的header里有事务id
   
   有关,你需要在 B 服务收到请求后在保存事务ID,然后在 http client 再调用的时候设置到 header里


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-pack] 515445681 commented on issue #671: 接收端抛出Failed to get reconnected sender, all alpha server is down.或 空指针 异常

Posted by GitBox <gi...@apache.org>.
515445681 commented on issue #671:
URL: https://github.com/apache/servicecomb-pack/issues/671#issuecomment-657992562


   @coolbeevip 0.5.0版本没有hystrix的包


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-pack] 515445681 commented on issue #671: 接收端抛出Failed to get reconnected sender, all alpha server is down.或 空指针 异常

Posted by GitBox <gi...@apache.org>.
515445681 commented on issue #671:
URL: https://github.com/apache/servicecomb-pack/issues/671#issuecomment-657983141


   > 用的什么版本?服务A,B完整的启动参数是什么?
   
   回复好快~
   
   0.5.0版本。
   
   启动只用了starter和feign的传输包
   
   ```
           <dependency>
               <groupId>org.apache.servicecomb.pack</groupId>
               <artifactId>omega-spring-starter</artifactId>
           </dependency>
           <dependency>
               <groupId>org.apache.servicecomb.pack</groupId>
               <artifactId>omega-transport-feign</artifactId>
           </dependency>
   ```
   
   参数只配了
   
   ```
   alpha:
     cluster:
       address: 127.0.0.1:8080
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-pack] 515445681 removed a comment on issue #671: 接收端抛出Failed to get reconnected sender, all alpha server is down.或 空指针 异常

Posted by GitBox <gi...@apache.org>.
515445681 removed a comment on issue #671:
URL: https://github.com/apache/servicecomb-pack/issues/671#issuecomment-657991956


   @coolbeevip 
   现在只有A和B两个项目,A调用B的时候已经在header里存在事务id了。
   B项目接到请求也可以打印出来A项目传递过来的id。
   您说的接到请求保存事务id,是保存到哪里。
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-pack] 515445681 commented on issue #671: 接收端抛出Failed to get reconnected sender, all alpha server is down.或 空指针 异常

Posted by GitBox <gi...@apache.org>.
515445681 commented on issue #671:
URL: https://github.com/apache/servicecomb-pack/issues/671#issuecomment-657991934






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-pack] coolbeevip commented on issue #671: 接收端抛出Failed to get reconnected sender, all alpha server is down.或 空指针 异常

Posted by GitBox <gi...@apache.org>.
coolbeevip commented on issue #671:
URL: https://github.com/apache/servicecomb-pack/issues/671#issuecomment-657989561


   > @coolbeevip A程序使用的@FeignClient(value = "")调用的B,没有用到resttemplate,hystrix用到了,我加一下看看
   
   FeignClient 内部使用的也是 resttemplate


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-pack] coolbeevip commented on issue #671: 接收端抛出Failed to get reconnected sender, all alpha server is down.异常

Posted by GitBox <gi...@apache.org>.
coolbeevip commented on issue #671:
URL: https://github.com/apache/servicecomb-pack/issues/671#issuecomment-657982309


   用的什么版本?服务A,B完整的启动参数是什么?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-pack] coolbeevip commented on issue #671: 接收端抛出Failed to get reconnected sender, all alpha server is down.或 空指针 异常

Posted by GitBox <gi...@apache.org>.
coolbeevip commented on issue #671:
URL: https://github.com/apache/servicecomb-pack/issues/671#issuecomment-657994126


   B服务在调用自己的service的时候会从上下文对象 OmegaContext 中获取事务IP,然后调用 alpha,从你的日志中看应该是header中的事务ID没有保存到上下文对象 OmegaContext 中,这部分您可以参考 RestTemplate的实现
   
   src/main/java/org/apache/servicecomb/pack/omega/transport/resttemplate


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-pack] coolbeevip commented on issue #671: 接收端抛出Failed to get reconnected sender, all alpha server is down.或 空指针 异常

Posted by GitBox <gi...@apache.org>.
coolbeevip commented on issue #671:
URL: https://github.com/apache/servicecomb-pack/issues/671#issuecomment-657989906


   你可以看一下项目自带的 demo 
   demo/saga-spring-demo


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-pack] 515445681 commented on issue #671: 接收端抛出Failed to get reconnected sender, all alpha server is down.或 空指针 异常

Posted by GitBox <gi...@apache.org>.
515445681 commented on issue #671:
URL: https://github.com/apache/servicecomb-pack/issues/671#issuecomment-657986876


   @coolbeevip A程序使用的@FeignClient(value = "")调用的B,没有用到resttemplate,hystrix用到了,我加一下看看


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-pack] 515445681 closed issue #671: 接收端抛出Failed to get reconnected sender, all alpha server is down.或 空指针 异常

Posted by GitBox <gi...@apache.org>.
515445681 closed issue #671:
URL: https://github.com/apache/servicecomb-pack/issues/671


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-pack] 515445681 commented on issue #671: 接收端抛出Failed to get reconnected sender, all alpha server is down.或 空指针 异常

Posted by GitBox <gi...@apache.org>.
515445681 commented on issue #671:
URL: https://github.com/apache/servicecomb-pack/issues/671#issuecomment-657994985


   @coolbeevip 
   ok,看到这块代码了,缺个拦截器,感谢


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-pack] 515445681 commented on issue #671: 接收端抛出Failed to get reconnected sender, all alpha server is down.或 空指针 异常

Posted by GitBox <gi...@apache.org>.
515445681 commented on issue #671:
URL: https://github.com/apache/servicecomb-pack/issues/671#issuecomment-657989950


   @coolbeevip 我改成apache http client了。是不是跟这个有关系。但是我B端的header里有事务id


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-pack] coolbeevip commented on issue #671: 接收端抛出Failed to get reconnected sender, all alpha server is down.或 空指针 异常

Posted by GitBox <gi...@apache.org>.
coolbeevip commented on issue #671:
URL: https://github.com/apache/servicecomb-pack/issues/671#issuecomment-657993127


   > @coolbeevip 0.5.0版本没有hystrix的包
   
   如果你用 http client 代替了 resttemplate 那么就和 hystrix 无关了


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-pack] 515445681 commented on issue #671: 接收端抛出Failed to get reconnected sender, all alpha server is down.或 空指针 异常

Posted by GitBox <gi...@apache.org>.
515445681 commented on issue #671:
URL: https://github.com/apache/servicecomb-pack/issues/671#issuecomment-657993720


   嗯嗯,那我现在httpclient的应该怎么搞,需要额外做处理吗,我这边数据库里也有日志进去。
   
   ![image](https://user-images.githubusercontent.com/11323678/87391554-88b18100-c5dd-11ea-82da-cc0cab86c244.png)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-pack] coolbeevip commented on issue #671: 接收端抛出Failed to get reconnected sender, all alpha server is down.或 空指针 异常

Posted by GitBox <gi...@apache.org>.
coolbeevip commented on issue #671:
URL: https://github.com/apache/servicecomb-pack/issues/671#issuecomment-657985439


   我不确定你的A,B程序是否使用了以下技术,不过您可以增加以下依赖试试
   
   ```xml
       <dependency>
         <groupId>org.apache.servicecomb.pack</groupId>
         <artifactId>omega-transport-resttemplate</artifactId>
       </dependency>
       <dependency>
         <groupId>org.apache.servicecomb.pack</groupId>
         <artifactId>omega-transport-hystrix</artifactId>
       </dependency>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-pack] 515445681 commented on issue #671: 接收端抛出Failed to get reconnected sender, all alpha server is down.或 空指针 异常

Posted by GitBox <gi...@apache.org>.
515445681 commented on issue #671:
URL: https://github.com/apache/servicecomb-pack/issues/671#issuecomment-657993868


   但是感觉B项目一种情况是连不上,一种是无法设置全局事务id


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org