Parallel RPC Streaming Operations Block Until All Sessions Complete #6023
-
Hello, I'm experiencing unexpected behavior with parallel RPC streaming operations in FastDDS. When I create multiple streaming operations (e.g., sum_all) in parallel, I cannot retrieve results from completed operations until ALL started operations are finished. auto writer1 = std::shared_ptr<RpcClientWriter<int32_t>>();
auto future1 = client->sum_all(writer1);
auto writer2 = std::shared_ptr<RpcClientWriter<int32_t>>();
auto future2 = client->sum_all(writer2);
// Complete only the second operation
writer2->write(3);
writer2->finish();
// Try to get result from completed operation
auto result2 = future2.get(); // This blocks/times out! Expected Behavior: writer1->finish(); // Must finish this too
auto result2 = future2.get(); // Now this works |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The example server creates a thread pool for processing requests. Also, as explained in this section of the documentation, you can pass a custom scheduler when creating the server, instead of using the default (thread pool) one. |
Beta Was this translation helpful? Give feedback.
The example server creates a thread pool for processing requests.
The number of threads in the pool is passed in the call to
create_CalculatorServer
.In the example, a value of
0
is used, which is equivalent to passing1
.Passing a bigger number will make the server process requests in parallel.
Also, as explained in this section of the documentation, you can pass a custom scheduler when creating the server, instead of using the default (thread pool) one.