Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

调用java服务报错reflect: call of reflect.Value.MethodByName on zero Value #2403

Open
ssfyn opened this issue Aug 28, 2023 · 10 comments
Open
Milestone

Comments

@ssfyn
Copy link

ssfyn commented Aug 28, 2023

问题

  • go调用go的服务能能跑通,但是go调用java的服务时报错
  • 通过看zk内容发现go的服务的dubbo.metadata-service.url-paramsprotodubbo,但java的服务是tri,不确定和这个有没有关系。

错误讯息

panic: reflect: call of reflect.Value.MethodByName on zero Value

goroutine 130 [running]:
reflect.Value.MethodByName({0x0?, 0x0?, 0x1400066ad58?}, {0x103d55724?, 0x14000181740?})
	/usr/local/go/src/reflect/value.go:2026 +0x114
github.com/dubbogo/triple/pkg/triple.getInvoker({0x0?, 0x0?}, 0x15?)
	/Users/me/go/pkg/mod/github.com/dubbogo/triple@v1.2.2-rc3/pkg/triple/dubbo3_conn.go:79 +0x194
github.com/dubbogo/triple/pkg/triple.NewTripleClient({0x0, 0x0}, 0x6?)
	/Users/me/go/pkg/mod/github.com/dubbogo/triple@v1.2.2-rc3/pkg/triple/dubbo3_client.go:117 +0x764
dubbo.apache.org/dubbo-go/v3/protocol/dubbo3.NewDubboInvoker(0x1400053e300)
	/Users/me/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.1.0/protocol/dubbo3/dubbo3_invoker.go:128 +0x898
dubbo.apache.org/dubbo-go/v3/protocol/dubbo3.(*DubboProtocol).Refer(0x14000346580, 0x1400053e300)
	/Users/me/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.1.0/protocol/dubbo3/dubbo3_protocol.go:137 +0x28
dubbo.apache.org/dubbo-go/v3/metadata/service/local.createProxy({0x10454de80?, 0x1400069a8c0})
	/Users/me/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.1.0/metadata/service/local/metadata_service_proxy_factory.go:69 +0x128
dubbo.apache.org/dubbo-go/v3/metadata/service.(*BaseMetadataServiceProxyFactory).GetProxy(0x103d4f1e7?, {0x10454de80?, 0x1400069a8c0?})
	/Users/me/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.1.0/metadata/service/local_service.go:119 +0x34
dubbo.apache.org/dubbo-go/v3/registry/servicediscovery.GetMetadataInfo({0x10454de80, 0x1400069a8c0}, {0x1400037cc40, 0x20})
	/Users/me/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.1.0/registry/servicediscovery/service_instances_changed_listener_impl.go:209 +0x118
dubbo.apache.org/dubbo-go/v3/registry/servicediscovery.(*ServiceInstancesChangedListenerImpl).OnEvent(0x140002ca360, {0x104539f60?, 0x14000376190})
	/Users/me/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.1.0/registry/servicediscovery/service_instances_changed_listener_impl.go:91 +0x5e0
dubbo.apache.org/dubbo-go/v3/registry/servicediscovery.(*ServiceDiscoveryRegistry).SubscribeURL(0x140001ec870, 0x14000650b40, {0x1045356f0, 0x14000650fc0}, 0x14000199200)
	/Users/me/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.1.0/registry/servicediscovery/service_discovery_registry.go:236 +0x56c
dubbo.apache.org/dubbo-go/v3/registry/servicediscovery.(*ServiceMappingChangedListenerImpl).OnEvent(0x14000276080, {0x104539f90?, 0x14000791ef8?})
	/Users/me/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.1.0/registry/servicediscovery/service_mapping_change_listener_impl.go:84 +0x13c
dubbo.apache.org/dubbo-go/v3/registry/servicediscovery.(*ServiceDiscoveryRegistry).Subscribe(0x140000a42d0, 0x14000650b40, {0x1045356f0?, 0x14000650fc0})
	/Users/me/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.1.0/registry/servicediscovery/service_discovery_registry.go:216 +0x2e4
dubbo.apache.org/dubbo-go/v3/registry/directory.(*RegistryDirectory).Subscribe(0x14000650fc0, 0x14000650b40)
	/Users/me/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.1.0/registry/directory/directory.go:107 +0xd0
created by dubbo.apache.org/dubbo-go/v3/registry/protocol.(*registryProtocol).Refer
	/Users/me/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.1.0/registry/protocol/protocol.go:164 +0x1f4
@chickenlj
Copy link
Contributor

通过看zk内容发现go的服务的dubbo.metadata-service.url-params中proto是dubbo,但java的服务是tri,不确定和这个有没有关系。

请问使用的 dubbo-go 版本是? 3.1.0 吗?

@ssfyn
Copy link
Author

ssfyn commented Sep 4, 2023

通过看zk内容发现go的服务的dubbo.metadata-service.url-params中proto是dubbo,但java的服务是tri,不确定和这个有没有关系。

请问使用的 dubbo-go 版本是? 3.1.0 吗?

是的

@DMwangnima
Copy link
Contributor

@ssfyn 可以给一份go侧的配置内容吗?

@ssfyn
Copy link
Author

ssfyn commented Oct 7, 2023

@ssfyn 可以给一份go侧的配置内容吗?

dubbo:
  application:
    name: go-example 
    module: example 
    organization: example
    owner: me
    environment: local
  registries:
    demoZK:
      protocol: zookeeper
      timeout: 3s
      address: 127.0.0.1:2181
      registry-type: all
  metadata-report: 
    protocol: zk 
    address: 127.0.0.1:2181
  protocols:
    triple:
      name: tri
      port: 20000
  provider:
    services:
      GreeterServerImpl:
        protocol: tri
        interface: "com.goexample.Greeter"
  consumer:
    references:
      GreeterClientImpl:
        interface:  "org.apache.dubbo.samples.tri.unary.Greeter"
        protocol: "tri"

@DMwangnima
Copy link
Contributor

已经找到了问题链路,java侧的配置也能发一下么?

@ssfyn
Copy link
Author

ssfyn commented Oct 8, 2023

已经找到了问题链路,java侧的配置也能发一下么?

配置文件是这个

dubbo:
  application:
    name: dubbo-springboot-demo-provider
  protocol:
    name: tri
    port: -1
  registry:
    address: zookeeper://127.0.0.1:2181

java这块儿起的服务是直接使用的这个demo:
https://github.com/apache/dubbo-samples/tree/master/1-basic/dubbo-samples-triple-unary

@FoghostCn
Copy link
Contributor

FoghostCn commented Dec 12, 2023

已经找到了问题链路,java侧的配置也能发一下么?

配置文件是这个

dubbo:
  application:
    name: dubbo-springboot-demo-provider
  protocol:
    name: tri
    port: -1
  registry:
    address: zookeeper://127.0.0.1:2181

java这块儿起的服务是直接使用的这个demo: https://github.com/apache/dubbo-samples/tree/master/1-basic/dubbo-samples-triple-unary

404 - page not found, is 3.2 branch ?

@DMwangnima
Copy link
Contributor

已经找到了问题链路,java侧的配置也能发一下么?

配置文件是这个

dubbo:
  application:
    name: dubbo-springboot-demo-provider
  protocol:
    name: tri
    port: -1
  registry:
    address: zookeeper://127.0.0.1:2181

java这块儿起的服务是直接使用的这个demo: https://github.com/apache/dubbo-samples/tree/master/1-basic/dubbo-samples-triple-unary

404 - page not found, is 3.2 branch ?

应该是这个https://github.com/apache/dubbo-samples/tree/3.2/1-basic/dubbo-samples-triple-unary

@FoghostCn
Copy link
Contributor

FoghostCn commented Dec 12, 2023

reproduced success,in dubbo-go tri depens on some stub method in generated pb.go file,
just like that

func (c *GreeterClientImpl) GetDubboStub(cc *triple.TripleConn) GreeterClient {
	return NewGreeterClient(cc)
}

https://github.com/dubbogo/triple/blob/df20316cdac5c5334f6cbf57bd3443cd75a4501f/pkg/triple/dubbo3_conn.go#L79

in metadata module it use low level api to invoke rpc, no pb.go file and GetDubboStub method generated

func (m *MetadataServiceProxy) GetMetadataInfo(revision string) (*common.MetadataInfo, error) {
rV := reflect.ValueOf(revision)
const methodName = "getMetadataInfo"
inv := invocation.NewRPCInvocationWithOptions(invocation.WithMethodName(methodName),
invocation.WithArguments([]interface{}{rV.Interface()}),
invocation.WithReply(reflect.ValueOf(&common.MetadataInfo{}).Interface()),
invocation.WithAttachments(map[string]interface{}{constant.AsyncKey: "false"}),
invocation.WithParameterValues([]reflect.Value{rV}))
res := m.Invoker.Invoke(context.Background(), inv)
if res.Error() != nil {
logger.Errorf("could not get the metadata info from remote provider: %v", res.Error())
return nil, res.Error()
}
metaDataInfo := res.Result().(*common.MetadataInfo)
return metaDataInfo, nil
}

in fact tri protocol not supported in metadata service rpc client

@FoghostCn
Copy link
Contributor

FoghostCn commented Dec 12, 2023

@ssfyn in java server side,set dubbo.application.metadataServiceProtocol=dubbo to avoid this problem, we will fix it in next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants