diff --git a/cluster/cluster_impl/failover_cluster_invoker.go b/cluster/cluster_impl/failover_cluster_invoker.go
index 2ce393cc3c84479b95d5df3d7e8ab47c0ca07e74..4260a9324dd360ac24f80e425d8542a423c8815e 100644
--- a/cluster/cluster_impl/failover_cluster_invoker.go
+++ b/cluster/cluster_impl/failover_cluster_invoker.go
@@ -19,6 +19,7 @@ package cluster_impl
import (
"context"
+ "fmt"
"strconv"
)
@@ -92,8 +93,10 @@ func (invoker *failoverClusterInvoker) Invoke(ctx context.Context, invocation pr
invokerSvc := invoker.GetUrl().Service()
invokerUrl := invoker.directory.GetUrl()
return &protocol.RPCResult{
- Err: perrors.Errorf("Failed to invoke the method %v in the service %v. Tried %v times of the providers %v (%v/%v)from the registry %v on the consumer %v using the dubbo version %v. Last error is %v.",
- methodName, invokerSvc, retries, providers, len(providers), len(invokers), invokerUrl, ip, constant.Version, result.Error().Error(),
+ Err: perrors.Wrap(result.Error(), fmt.Sprintf("Failed to invoke the method %v in the service %v. "+
+ "Tried %v times of the providers %v (%v/%v)from the registry %v on the consumer %v using the dubbo version %v. "+
+ "Last error is %+v.", methodName, invokerSvc, retries, providers, len(providers), len(invokers),
+ invokerUrl, ip, constant.Version, result.Error().Error()),
)}
}
diff --git a/common/proxy/proxy.go b/common/proxy/proxy.go
index abcf87cd9d297769bf8aff6fa07d6a4659091eb6..ce0f4d1d3f4dc8b93467aaeede40ea03b53c6e66 100644
--- a/common/proxy/proxy.go
+++ b/common/proxy/proxy.go
@@ -23,6 +23,11 @@ import (
"sync"
)
+import (
+ "github.com/apache/dubbo-go-hessian2/java_exception"
+ perrors "github.com/pkg/errors"
+)
+
import (
"github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/common/constant"
@@ -154,7 +159,18 @@ func (p *Proxy) Implement(v common.RPCService) {
}
err = result.Error()
- logger.Debugf("[makeDubboCallProxy] result: %v, err: %v", result.Result(), err)
+ if err != nil {
+ // the cause reason
+ err = perrors.Cause(err)
+ // if some error happened, it should be log some info in the seperate file.
+ if throwabler, ok := err.(java_exception.Throwabler); ok {
+ logger.Warnf("invoke service throw exception: %v , stackTraceElements: %v", err.Error(), throwabler.GetStackTrace())
+ } else {
+ logger.Warnf("result err: %v", err)
+ }
+ } else {
+ logger.Debugf("[makeDubboCallProxy] result: %v, err: %v", result.Result(), err)
+ }
if len(outs) == 1 {
return []reflect.Value{reflect.ValueOf(&err).Elem()}
}
diff --git a/protocol/invocation/rpcinvocation.go b/protocol/invocation/rpcinvocation.go
index b8b5b509702ea5ee62df83eb55bf7f1c86625b26..953d50ca46d3e5613655720affdab9bfd7ae9a67 100644
--- a/protocol/invocation/rpcinvocation.go
+++ b/protocol/invocation/rpcinvocation.go
@@ -157,6 +157,8 @@ func (r *RPCInvocation) Invoker() protocol.Invoker {
// nolint
func (r *RPCInvocation) SetInvoker(invoker protocol.Invoker) {
+ r.lock.Lock()
+ defer r.lock.Unlock()
r.invoker = invoker
}