dubbo-python2 icon indicating copy to clipboard operation
dubbo-python2 copied to clipboard

python consumer send request to provider, the provider can reciver the request correct but the consumer can not reciver response

Open jiuchongxiao opened this issue 6 years ago • 3 comments

DEBUG:python-dubbo:Current IP Address: 192.168.1.128 DEBUG:python-dubbo:Create consumer {'methods': u'sayHello', 'timestamp': 1549863219591L, 'pid': 17308, 'connected': 'true', 'interface': u'com.xiaoze.api.service.DemoService', 'check': 'false', 'category': 'consumers', 'dubbo': u'2.6.2', 'application': 'search_platform', 'version': u'1.0.0', 'side': 'consumer', 'revision': u'1.0.0'} DEBUG:kazoo.client:Sending request(xid=3): Exists(path='/dubbo/com.xiaoze.api.service.DemoService/consumers', watcher=None) DEBUG:kazoo.client:Received response(xid=3): ZnodeStat(czxid=753, mzxid=753, ctime=1549852990368L, mtime=1549852990368L, version=0, cversion=87, aversion=0, ephemeralOwner=0, dataLength=0, numChildren=1, pzxid=910) DEBUG:kazoo.client:Sending request(xid=4): Create(path='/dubbo/com.xiaoze.api.service.DemoService/consumers/consumer%3A%2F%2F192.168.1.128%2Fcom.xiaoze.api.service.DemoService%3Fapplication%3Dsearch_platform%26category%3Dconsumers%26check%3Dfalse%26connected%3Dtrue%26dubbo%3D2.6.2%26interface%3Dcom.xiaoze.api.service.DemoService%26methods%3DsayHello%26pid%3D17308%26revision%3D1.0.0%26side%3Dconsumer%26timestamp%3D1549863219591%26version%3D1.0.0', data='', acl=[ACL(perms=31, acl_list=['ALL'], id=Id(scheme='world', id='anyone'))], flags=1) DEBUG:kazoo.client:Sending request(xid=5): GetChildren(path='/dubbo/com.xiaoze.api.service.DemoService/configurators', watcher=<bound method ZkRegister._watch_configurators of <dubbo.client.ZkRegister object at 0x00000000041BC630>>) DEBUG:kazoo.client:Received response(xid=4): u'/dubbo/com.xiaoze.api.service.DemoService/consumers/consumer%3A%2F%2F192.168.1.128%2Fcom.xiaoze.api.service.DemoService%3Fapplication%3Dsearch_platform%26category%3Dconsumers%26check%3Dfalse%26connected%3Dtrue%26dubbo%3D2.6.2%26interface%3Dcom.xiaoze.api.service.DemoService%26methods%3DsayHello%26pid%3D17308%26revision%3D1.0.0%26side%3Dconsumer%26timestamp%3D1549863219591%26version%3D1.0.0' DEBUG:kazoo.client:Received response(xid=5): [] DEBUG:python-dubbo:Start request, host=192.168.56.1:20880, params={'path': 'com.xiaoze.api.service.DemoService', 'version': '1.0.0', 'dubbo_version': '2.4.10', 'method': 'sayHello', 'arguments': ['A000000']} DEBUG:python-dubbo:Waiting response, invoke_id=0, timeout=60000, host=192.168.56.1:20880 DEBUG:python-dubbo:Send ❤ request for invoke_id 1, host=192.168.56.1:20880 DEBUG:python-dubbo:Send ❤ request for invoke_id 2, host=192.168.56.1:20880 DEBUG:python-dubbo:Send ❤ request for invoke_id 3, host=192.168.56.1:20880 DEBUG:python-dubbo:192.168.56.1:20880 closed by client. DEBUG:python-dubbo:192.168.56.1:20880 timeout and reconnected by client. DEBUG:python-dubbo:Send ❤ request for invoke_id 4, host=192.168.56.1:20880 DEBUG:python-dubbo:Send ❤ request for invoke_id 5, host=192.168.56.1:20880 DEBUG:python-dubbo:Send ❤ request for invoke_id 6, host=192.168.56.1:20880 DEBUG:python-dubbo:192.168.56.1:20880 closed by client.

jiuchongxiao avatar Feb 11 '19 05:02 jiuchongxiao

the provider use java language,and the protocol use dubbo or hessian, the result is same. and the provider can print the log ================hello python dubbo client name:A000000

jiuchongxiao avatar Feb 11 '19 05:02 jiuchongxiao

the provider config is below:

spring.application.name = dubbo-provider
server.port = 9090

#指定当前服务/应用的名字(同样的服务名字相同,不要和别的服务同名)
dubbo.application.name = dubbo-provider

demo.service.version = 1.0.0

#dubbo.protocol.name = jsonrpc
#dubbo.protocol.name = hessian
#dubbo.protocol.port = 8888

#指定注册中心的位置
dubbo.registry.address = zookeeper://localhost:2181

#统一设置服务提供方的规则
dubbo.provider.timeout = 1000

and the interface as below:


@Service(version = "${demo.service.version}")
public class DemoServiceImpl implements DemoService {

    @Override
    public String sayHello(String name) {
        System.out.println("================hello python dubbo client name:"+name);
        return "Hello, " + name + " (from Spring Boot)";
    }
}

the consumer as below:

# -*- coding: utf-8 -*-
from dubbo.client import DubboClient, ZkRegister, logging

# LOG_FILENAME = 'example.log'
logging.basicConfig(level=logging.DEBUG)
# logging.basicConfig(filename=LOG_FILENAME, level=logging.DEBUG)

logging.debug('logger---------------:')
# 支持从Zk中获取服务的provider,支持根据provider的权重选择主机
zk = ZkRegister('127.0.0.1:2181')
dubbo_cli = DubboClient('com.xiaoze.api.service.DemoService', zk_register=zk)

# 支持不使用Zk,直接连接指定的远程主机
# dubbo_cli = DubboClient('com.xiaoze.api.service.DemoService', host='127.0.0.1:8888')

name = 'A000000'
result = dubbo_cli.call('sayHello', name, timeout=60000)
logging.debug("++++++++++++++++")
logging.info("==========================="+result)

jiuchongxiao avatar Feb 11 '19 06:02 jiuchongxiao

It seems that there is no response message sent by the server, there is currently no way to determine the reason, it is recommended to use Wireshark to capture the network packet and analysis it.

RitterHou avatar Feb 11 '19 07:02 RitterHou