[ 
https://issues.apache.org/jira/browse/SCB-2004?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lei Zhang updated SCB-2004:
---------------------------
    Description: 
If the Alpha's compensation call is received during the business service 
startup process, compensation failure will occasionally occur

 
 Because at startup, it will be connected to Alpha first, and then all 
compensation methods will be scanned and put to the class CallbackContext, If 
business service receives a compensation request before CallbackContext 
initialization, you will get NullPointerExceptionBecause at startup, it will be 
connected to Alpha first, and then all compensation methods will be scanned and 
put to the class CallbackContext, If business service receives a compensation 
request before CallbackContext initialization, you will get NullPointerException

 
{code:java}
  public void apply(String globalTxId, String localTxId, String parentTxId, 
String callbackMethod, Object... payloads) {
    CallbackContextInternal contextInternal = contexts.get(callbackMethod); 
<----- this is empty
    String oldGlobalTxId = omegaContext.globalTxId();
    String oldLocalTxId = omegaContext.localTxId();
    try {
      omegaContext.setGlobalTxId(globalTxId);
      omegaContext.setLocalTxId(localTxId);
      contextInternal.callbackMethod.invoke(contextInternal.target, payloads);
      if (omegaContext.getAlphaMetas().isAkkaEnabled()) {
        sender.send(
            new TxCompensateAckSucceedEvent(omegaContext.globalTxId(), 
omegaContext.localTxId(),
                parentTxId, callbackMethod));
      }
{code}
 

  was:
If the Alpha's compensation call is received during the business service 
startup process, compensation failure will occasionally occur

 
 Because at startup, it will be connected to Alpha first, and then all 
compensation methods will be scanned and put to the class CallbackContext, If 
business service receives a compensation request before CallbackContext 
initialization, you will get NullPointerExceptionBecause at startup, it will be 
connected to Alpha first, and then all compensation methods will be scanned and 
put to the class CallbackContext, If business service receives a compensation 
request before CallbackContext initialization, you will get NullPointerException

 

 

 
{code:java}
  public void apply(String globalTxId, String localTxId, String parentTxId, 
String callbackMethod, Object... payloads) {
    CallbackContextInternal contextInternal = contexts.get(callbackMethod); 
<----- this is empty
    String oldGlobalTxId = omegaContext.globalTxId();
    String oldLocalTxId = omegaContext.localTxId();
    try {
      omegaContext.setGlobalTxId(globalTxId);
      omegaContext.setLocalTxId(localTxId);
      contextInternal.callbackMethod.invoke(contextInternal.target, payloads);
      if (omegaContext.getAlphaMetas().isAkkaEnabled()) {
        sender.send(
            new TxCompensateAckSucceedEvent(omegaContext.globalTxId(), 
omegaContext.localTxId(),
                parentTxId, callbackMethod));
      }
{code}
 


> When the business service startup is not completed, receiving a compensation 
> request will cause gRPC and alpha to reconnect
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SCB-2004
>                 URL: https://issues.apache.org/jira/browse/SCB-2004
>             Project: Apache ServiceComb
>          Issue Type: Bug
>          Components: Saga
>    Affects Versions: pack-0.6.0
>            Reporter: Lei Zhang
>            Priority: Major
>
> If the Alpha's compensation call is received during the business service 
> startup process, compensation failure will occasionally occur
>  
>  Because at startup, it will be connected to Alpha first, and then all 
> compensation methods will be scanned and put to the class CallbackContext, If 
> business service receives a compensation request before CallbackContext 
> initialization, you will get NullPointerExceptionBecause at startup, it will 
> be connected to Alpha first, and then all compensation methods will be 
> scanned and put to the class CallbackContext, If business service receives a 
> compensation request before CallbackContext initialization, you will get 
> NullPointerException
>  
> {code:java}
>   public void apply(String globalTxId, String localTxId, String parentTxId, 
> String callbackMethod, Object... payloads) {
>     CallbackContextInternal contextInternal = contexts.get(callbackMethod); 
> <----- this is empty
>     String oldGlobalTxId = omegaContext.globalTxId();
>     String oldLocalTxId = omegaContext.localTxId();
>     try {
>       omegaContext.setGlobalTxId(globalTxId);
>       omegaContext.setLocalTxId(localTxId);
>       contextInternal.callbackMethod.invoke(contextInternal.target, payloads);
>       if (omegaContext.getAlphaMetas().isAkkaEnabled()) {
>         sender.send(
>             new TxCompensateAckSucceedEvent(omegaContext.globalTxId(), 
> omegaContext.localTxId(),
>                 parentTxId, callbackMethod));
>       }
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to