Skip to content

false positive in grpc_is_epollexclusive_available() #22182

@tbuyukliev

Description

@tbuyukliev

What version of gRPC and what language are you using?

1.27.3, C++

What operating system (Linux, Windows,...) and version?

VMware ESXi 6.7

grpc_is_epollexclusive_available() checks that the invalid EPOLLEXCLUSIVE | EPOLLONESHOT flag combination fails with EINVAL and declares success, but not that any other valid combination that has EPOLLEXCLUSIVE succeeds.

VMware's VMkernel supports epoll, but not EPOLLEXCLUSIVE. it returns EINVAL just because it sees the unsupported flag and grpc_is_epollexclusive_available() returns true.

the end of the function should be changed to also do a positive check, for example:

  // Now check that EPOLLEXCLUSIVE is supported at all.
  ev.events =
      static_cast<uint32_t>(EPOLLET | EPOLLIN | EPOLLEXCLUSIVE);
  if (epoll_ctl(fd, EPOLL_CTL_ADD, evfd, &ev) != 0) {
    if (!logged_why_not) {
      gpr_log(GPR_DEBUG,
              "epoll_ctl with EPOLLEXCLUSIVE failed with error: "
              "%d. Not using epollex polling engine.",
              errno);
      logged_why_not = true;
    }
    close(fd);
    close(evfd);
    return false;
  }

  close(evfd);
  close(fd);
  return true;
}

also it will be good the file descriptors to be closed by RAII.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions