我在我的应用程序中使用 C++ 异步 thrift 进行 IPC。
我的 Thrift 的一个客户端使用
T_PROTOCOL_COMPACT
协议使用 TCompactProtocolFactory
连接到服务器(当然传输是 TAsioTcpConnectServerTransport
)。
我确实看到我的客户端已成功连接到服务器。
客户端:
2024-01-29 09:23:40,636 INFO [0x7ffff53576c0] ClientEventHandler<Interface> (../../src/ipc/thrift/AsyncThriftClient.tpp:68) 229 - "Function":"onConnect", "Event":"ASYNC_THRIFT_CLIENT_ON_CONNECT", "Message":"Client connects to the server", "ServiceName":"MulpiSvcClient.10.244.22.229", "RemoteEndpoint":"10.244.22.229:23501"
2024-01-29 09:23:40,636 INFO [0x7ffff53576c0] ClientEventHandler<Interface> (../../src/ipc/thrift/AsyncThriftClient.tpp:75) 229 - "Function":"onConnect", "Event":"ASYNC_THRIFT_CLIENT_ON_CONNECT", "Message":"Client was created successfully to the server"
服务器端
2024-01-29T09:23:40.636009637Z {"Role": "active", "Severity": "INFO", "Package": "server", "Version" : "1.48-598.2", "File": "ThriftServiceManager.hpp:25", "Logger": "server.api", "Function": "onConnect", Connected local=[::ffff:10.244.22.228]:23501 remote=[::ffff:10.244.22.253]:52436}
但我发现有时调用会成功,但大多数时候我会抛出 TException。
Thrift: Mon Jan 29 09:22:01 2024 Unhandled exception MISSING_RESULT Exception: 'GetOfdmaCmMerData'
有什么原因会导致这种情况发生吗?是因为服务器端丢弃了客户端请求还是客户端没有等待服务器响应足够的时间?
编辑:
在此处添加成功调用的日志
2024-01-29T09:47:38.293726795Z {"Severity": "ERROR", "Package": "client", "Version" : "1.0-21", "File": "../../src/external-interfaces/mulpi/clientInterface.cpp", "Line": "272", "Function": "GetOfdmaCmMerData", "Event":"EXT_IFACES_MULPI_GET_OFDMA_CHANNEL_DATA", "Message":"GetOfdmaCmMerData", "Id":"0x1000000", "subId":"0x29", "serverIp":"10.244.22.229", "mdOfdmaCmMerDataFetchSize:":"MdOfdmaCmMerData {
2024-01-29T09:47:38.293762061Z Id: 16777216
2024-01-29T09:47:38.293769181Z SubId: 0
2024-01-29T09:47:38.293773881Z ofdmaCmMerData: OfdmaCmMerData {
2024-01-29T09:47:38.293778161Z mslotsInfo:
2024-01-29T09:47:38.293782125Z Key: 0, Value: MinislotInfo {
2024-01-29T09:47:38.293785868Z index: 0
2024-01-29T09:47:38.293789721Z lowerFreq: 39000000
2024-01-29T09:47:38.293793793Z }
2024-01-29T09:47:38.293797520Z Key: 1, Value: MinislotInfo {
2024-01-29T09:47:38.293801191Z index: 1
2024-01-29T09:47:38.293805018Z lowerFreq: 39400000
2024-01-29T09:47:38.293808412Z }
2024-01-29T09:47:38.293812383Z Key: 2, Value: MinislotInfo {
2024-01-29T09:47:38.293816468Z index: 2
2024-01-29T09:47:38.293820141Z lowerFreq: 39800000
2024-01-29T09:47:38.293823760Z }
...
2024-01-29T09:47:38.302070699Z Key: 170, Value: MinislotInfo {
2024-01-29T09:47:38.302074986Z index: 170
2024-01-29T09:47:38.302079187Z lowerFreq: 107000000
2024-01-29T09:47:38.302083072Z }
2024-01-29T09:47:38.302087105Z mers:
2024-01-29T09:47:38.302091026Z }
已解决:
问题是有时会使用相同的 THRIFT IFACE 但使用不同的 IP 打开到服务器的连接,其中没有请求的数据。