grpc sync server crash with increasing clients

131 views
Skip to first unread message

Roshan Chaudhari

unread,
Oct 27, 2021, 6:19:42 AM10/27/21
to grpc.io
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

Roshan Chaudhari

unread,
Oct 27, 2021, 7:13:26 AM10/27/21
to grpc.io
I found the problem, i am hitting a "ulimit -n" limit, since my test is running on a same machine, it creates n channels for n clients which corresponds to socket file for each of them.

--
You received this message because you are subscribed to a topic in the Google Groups "grpc.io" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/grpc-io/jsJcqzOwcxg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/1d8d4b45-4efc-43e7-ac6b-422880e2313dn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages