"vscode:/vscode.git/clone" did not exist on "7a587349943325e667866971a36996a56fcff143"
Unverified Commit 1f5f31ce authored by Jinjing Zhou's avatar Jinjing Zhou Committed by GitHub
Browse files

Fix hang when sending empty ndarray in rpc request (#2022)

* aaa

* revert

* 111

* fix

* fff

* 111

* try

* debug

* fff

* 111

* 1111

* fix

* try

* 111

* 111

* print

* f

* 111

* revert

* fix

* revert

* add timeout

* Revert "add timeout"

This reverts commit fb34f67f11ad6556824daa6efa29a6ec2c7c1d3e.
parent c113a5a0
......@@ -27,9 +27,8 @@ RPCStatus SendRPCMessage(const RPCMessage& msg, const int32_t target_id) {
std::shared_ptr<std::string> zerocopy_blob(new std::string());
StreamWithBuffer zc_write_strm(zerocopy_blob.get(), true);
zc_write_strm.Write(msg);
int32_t ndarray_count = msg.tensors.size();
zerocopy_blob->append(
reinterpret_cast<char*>(&ndarray_count),
int32_t nonempty_ndarray_count = zc_write_strm.buffer_list().size();
zerocopy_blob->append(reinterpret_cast<char*>(&nonempty_ndarray_count),
sizeof(int32_t));
network::Message rpc_meta_msg;
rpc_meta_msg.data = const_cast<char*>(zerocopy_blob->data());
......@@ -61,10 +60,10 @@ RPCStatus RecvRPCMessage(RPCMessage* msg, int32_t timeout) {
CHECK_EQ(RPCContext::ThreadLocal()->receiver->Recv(
&rpc_meta_msg, &send_id), REMOVE_SUCCESS);
char* count_ptr = rpc_meta_msg.data+rpc_meta_msg.size-sizeof(int32_t);
int32_t ndarray_count = *(reinterpret_cast<int32_t*>(count_ptr));
int32_t nonempty_ndarray_count = *(reinterpret_cast<int32_t*>(count_ptr));
// Recv real ndarray data
std::vector<void* > buffer_list(ndarray_count);
for (int i = 0; i < ndarray_count; ++i) {
std::vector<void*> buffer_list(nonempty_ndarray_count);
for (int i = 0; i < nonempty_ndarray_count; ++i) {
network::Message ndarray_data_msg;
CHECK_EQ(RPCContext::ThreadLocal()->receiver->RecvFrom(
&ndarray_data_msg, send_id), REMOVE_SUCCESS);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment