I am running sync server, and trying with multiple parallel client. However, i see crash in the server as I increase number of clients. here is a piece of code:
void fn() {
CreateServer(grpc::InsecureServerCredentials());
constexpr int kNumClients = 1000;
constexpr int kNumMsgs = 1000;
std::vector<std::thread> threads;
auto channel_creds = grpc::InsecureChannelCredentials();
for (int id = 0; id < kNumClients; id++) {
threads.emplace_back(([&] {
auto client = CreateClient(channel_creds);
test::TestRequest request;
for (int i = 0; i < kNumMsgs; i++) {
std::string temp;
temp.resize(6400);
request.set_data(temp.data(), temp.size());
if (!client->Write(request)) {
LOG(ERROR) << "writer returned false, exiting.. ";
break;
}
}
client.reset();
}));
}
for (int id = 0; id < kNumClients; id++) {
threads[id].join();
}
}
the error i am getting is:
E1027 15:32:51.515823940 28603 ev_epollex_linux.cc:1298] pollset_add_fd: {"created":"@1635328971.515750825","description":"pollset_transition_pollable_from_fd_to_multi","file":"external/com_github_grpc_grpc/src/core/lib/iomgr/ev_epollex_linux.cc","file_line":317,"referenced_errors":[{"created":"@1635328971.515713815","description":"Too many open files","errno":24,"file":"external/com_github_grpc_grpc/src/core/lib/iomgr/ev_epollex_linux.cc","file_line":560,"os_error":"Too many open files","syscall":"epoll_create1"}]}
"
what is it I am doing wrong here?
-
Roshan