workerman-thrift-rpc做服务端, java端 client 调用时而超时 时而成功?

小白鼠

我在用workerman-thrift-rpc做服务端
用以下方式
$worker->thriftProtocol='TCompactProtocol';
$worker->thriftTransport='TFramedTransport';
java端作为客户端,调用会出现

2019-03-21 10:04:50 pid:3053496 CODE:0 MESSAGE:TSocket: timed out reading 4 bytes from 192.168.3.**:20569
#0 /srv/qijizuopin_rpc/Applications/ThriftRpc/Lib/Thrift/Transport/TTransport.php(75): Thrift\Transport\TSocket->read(4)
#1 /srv/qijizuopin_rpc/Applications/ThriftRpc/Lib/Thrift/Transport/TFramedTransport.php(147): Thrift\Transport\TTransport->readAll(4)
#2 /srv/qijizuopin_rpc/Applications/ThriftRpc/Lib/Thrift/Transport/TFramedTransport.php(110): Thrift\Transport\TFramedTransport->readFrame()
#3 /srv/qijizuopin_rpc/Applications/ThriftRpc/Lib/Thrift/Transport/TTransport.php(75): Thrift\Transport\TFramedTransport->read(1)
#4 /srv/qijizuopin_rpc/Applications/ThriftRpc/Lib/Thrift/Protocol/TCompactProtocol.php(431): Thrift\Transport\TTransport->readAll(1)
#5 /srv/qijizuopin_rpc/Applications/ThriftRpc/Lib/Thrift/Protocol/TCompactProtocol.php(509): Thrift\Protocol\TCompactProtocol->readUByte(0)
#6 /srv/qijizuopin_rpc/Applications/ThriftRpc/Services/SearchBookListChapters/SearchBookListChapters.php(266): Thrift\Protocol\TCompactProtocol->readMessageBegin(NULL, 0, 0)
#7 /srv/qijizuopin_rpc/Applications/ThriftRpc/ThriftWorker.php(143): Services\SearchBookListChapters\SearchBookListChaptersProcessor->process(Object(Thrift\Protocol\TCompactProtocol), Object(Thrift\Protocol\TCompactProtocol))
#8 : ThriftWorker->onConnect(Object(Workerman\Connection\TcpConnection))
#9 /srv/qijizuopin_rpc/vendor/workerman/workerman/Worker.php(1527): call_user_func(Array, Object(Workerman\Connection\TcpConnection))
#10 : Workerman\Worker->acceptConnection(Resource id #41, 2, Resource id #41)
#11 /srv/qijizuopin_rpc/vendor/workerman/workerman/Events/Event.php(186): EventBase->loop()
#12 /srv/qijizuopin_rpc/vendor/workerman/workerman/Worker.php(1471): Workerman\Events\Event->loop()
#13 /srv/qijizuopin_rpc/vendor/workerman/workerman/Worker.php(899): Workerman\Worker->run()
#14 /srv/qijizuopin_rpc/vendor/workerman/workerman/Worker.php(865): Workerman\Worker::forkOneWorker(Object(ThriftWorker))
#15 /srv/qijizuopin_rpc/vendor/workerman/workerman/Worker.php(420): Workerman\Worker::forkWorkers()
#16 /srv/qijizuopin_rpc/start.php(29): Workerman\Worker::runAll() 

这种情况是我服务端哪里配置有问题么?

3462 2 0
2个回答

walkor 打赏

看报错是客户端连接到服务端后一直没有发来请求数据,导致服务端接收数据超时。
 
注意workerman-thrift-rpc是一个短连接服务,客户端连上服务端后要马上把请求发过来。

  • 小白鼠 2019-03-21

    有哪些配置可以设置成长链接么?或者增加timeout时长?

  • walkor 2019-03-21

    thrift的php库不支持长连接。不能增加timeout时长,会导致进程全部阻塞等待数据,导致服务不可用

  • 小白鼠 2019-03-21

    @1:好的,多谢

Mr_Deng

请问JAVA怎么调用呢? 看文档不是很明白

  • 暂无评论
年代过于久远,无法发表回答
×
🔝