1. 发现问题
a.问题
在使用thrift接口时出现丢失数据问题,输出对象正常是输出user和device信息,但是两种只能输出其中一个,出现丢失数据问题。
b. 应用环境
thrift 0.8.0
python 2.6.5
c.接口使用协议
TTransport.TBufferedTransportFactory
TCompactProtocol.TCompactProtocolFactory
2.找问题
a.确定服务器端已经写了数据user和device
b.客户端始终读取不到数据
c.更换其他版本thrift的py
client ,还是不行
d.在同事那里找了一个thrift_py 0.6的自定义修改版本,问题解决
当前采用:
TTransport.TFramedTransportFactory
TCompactProtocol.TBinaryProtocolFactory
处理了中文问题
e.在该py客户端下当修改为:
TTransport.TBufferedTransportFactory
TCompactProtocol.TCompactProtocolFactory
继续有问题,不调用服务报错
go on协议修改为:
TTransport.TBufferedTransportFactory
TCompactProtocol.TBinaryProtocolFactory
ok没有问题,纠结啊
f.再替换使用thrift 0.8.0的client
使用
TTransport.TBufferedTransportFactory
TCompactProtocol.TBinaryProtocolFactory
和
TTransport.TBufferedTransportFactory
TCompactProtocol.TCompactProtocolFactory
继续丢数据
修改thrift 0.8.0的client可处理中文后
TTransport.TBufferedTransportFactory
TCompactProtocol.TCompactProtocolFactory
继续丢数据
TTransport.TBufferedTransportFactory
TCompactProtocol.TBinaryProtocolFactory
和
TTransport.TFramedTransportFactory
TCompactProtocol.TBinaryProtocolFactory
ok,没有问题都能正常使用
3.解决方法
修改TBinaryProtocol.py
line 121 writeString方法:
def writeString(self, str):
if type(str) is unicode:
str = str.encode('utf-8')
self.writeI32(len(str))
self.trans.write(str)
thrift协议修改为:
TTransport.TBufferedTransportFactory
TCompactProtocol.TBinaryProtocolFactory
运行成功!
4. 总结
thrift赶紧修改bug吧
多沟通,闭门造车也许可能,但绝对浪费时间
同时让我们继续纠结吧。。。。
分享到:
相关推荐
Thrift使用示例代码,主要配合博客《由浅入深了解thrift》写的测试代码
网上一直搜不到Windows下QT使用thrift的例子,自己整了个 QT版本 5.8.0 Boost版本 boost_1_61_0 Thrift版本 thrift-0.10.0
该文档详细记录Thrift的使用
本文档详细说明了Linux和windows系统下配置thrift环境和hbaseC++客户端的使用。
使用wireshark抓取thrift协议接口调用
使用thrift、websocket在javascript和c++之间建立rpc调用机制。 如果要使用js+html来写界面,cpp来写底层业务逻辑,这就非常有用了。 当然,如果底层不用cpp来写,也可以参考本代码的js对thrift的rpc包装。
NULL 博文链接:https://gemantic.iteye.com/blog/1199214
java代码使用thrift2操作hbase示例,thrift2连接hbase添加数据,单条查找,删除数据,根据扫描器查找,修改数据等测试实例
详细介绍了Apache Thrift在Ubuntu以及Windows下基于C++和Java语言的安装和运行。附有小例子,亲自测试通过。所述方法网上应该有教程,但大多零散不统一或者不完整,因此本人整理了一份,特来分享。
thrift的使用一定会依赖boost,但是因为boost过大,附件没有包含,还需要自行编译
这是对Facebook开源框架Thrift的分享,并且附有示例代码。
Thrift 在Windows下的安装与实例 vs2010 本文的不同之处在于,不借助Cygwin或者MinGW,只用VS2010,和Thrift官网下载的源文件,安装Thrift并使用。 本文可用于thrift-0.9.1.tar.gz,thrift-0.10.0.tar.gz版本安装
windows环境下thrift.exe开发thrift
thrift源码thrift源码thrift源码thrift源码thrift源码thrift源码thrift源码thrift源码thrift源码thrift源码thrift源码thrift源码thrift源码thrift源码thrift源码thrift源码thrift源码thrift源码thrift源码thrift源码...
thrift 安装包。
php 使用thrift客户端访问服务器测试 下载后 放到站点根目录,设置 thrift_test.php里的 $socket = new TSocket('10.200.28.43', 10001); 修改为默认服务器和端口 后 直接访问 http://localhost/thrift_test.php
Apache Thrift is an open source cross language serialization and RPC framework. With support for over 15 programming languages, Apache Thrift can play an important role in a range of distributed ...
使用thrift js时,PRotocol需要使用TJSONPRotocol/TBinaryProtocol协议,Thrift.Protocol对应的是TJSONPRotocol。Transport需要使用TXHRTransport/TWebSocketTransport通道,Thrift.Transport对应的是TXHRTransport...
Java中使用Thrift实现RPC示例代码.rar
thrift官方代码+与dubbo集成支持原生thrift协议