log GRPC_POLL_STRATEGY when fail to find polling engine

also log reason to skip a polling engine
pull/13281/head
yang-g 7 years ago
parent e5bca395f9
commit 30101b05c6
  1. 3
      src/core/lib/iomgr/ev_epoll1_linux.cc
  2. 4
      src/core/lib/iomgr/ev_epollex_linux.cc
  3. 8
      src/core/lib/iomgr/ev_epollsig_linux.cc
  4. 1
      src/core/lib/iomgr/ev_poll_posix.cc
  5. 4
      src/core/lib/iomgr/ev_posix.cc

@ -1230,6 +1230,7 @@ static const grpc_event_engine_vtable vtable = {
* support is available */ * support is available */
const grpc_event_engine_vtable *grpc_init_epoll1_linux(bool explicit_request) { const grpc_event_engine_vtable *grpc_init_epoll1_linux(bool explicit_request) {
if (!grpc_has_wakeup_fd()) { if (!grpc_has_wakeup_fd()) {
gpr_log(GPR_ERROR, "Skipping epoll1 because of no wakeup fd.");
return NULL; return NULL;
} }
@ -1254,6 +1255,8 @@ const grpc_event_engine_vtable *grpc_init_epoll1_linux(bool explicit_request) {
/* If GRPC_LINUX_EPOLL is not defined, it means epoll is not available. Return /* If GRPC_LINUX_EPOLL is not defined, it means epoll is not available. Return
* NULL */ * NULL */
const grpc_event_engine_vtable *grpc_init_epoll1_linux(bool explicit_request) { const grpc_event_engine_vtable *grpc_init_epoll1_linux(bool explicit_request) {
gpr_log(GPR_ERROR,
"Skipping epollsig becuase GRPC_LINUX_EPOLL is not defined.");
return NULL; return NULL;
} }
#endif /* defined(GRPC_POSIX_SOCKET) */ #endif /* defined(GRPC_POSIX_SOCKET) */

@ -1447,10 +1447,12 @@ const grpc_event_engine_vtable *grpc_init_epollex_linux(
} }
if (!grpc_has_wakeup_fd()) { if (!grpc_has_wakeup_fd()) {
gpr_log(GPR_ERROR, "Skipping epollex because of no wakeup fd.");
return NULL; return NULL;
} }
if (!grpc_is_epollexclusive_available()) { if (!grpc_is_epollexclusive_available()) {
gpr_log(GPR_INFO, "Skipping epollex because it is not supported.");
return NULL; return NULL;
} }
@ -1476,6 +1478,8 @@ const grpc_event_engine_vtable *grpc_init_epollex_linux(
* NULL */ * NULL */
const grpc_event_engine_vtable *grpc_init_epollex_linux( const grpc_event_engine_vtable *grpc_init_epollex_linux(
bool explicitly_requested) { bool explicitly_requested) {
gpr_log(GPR_ERROR,
"Skipping epollex becuase GRPC_LINUX_EPOLL is not defined.");
return NULL; return NULL;
} }
#endif /* defined(GRPC_POSIX_SOCKET) */ #endif /* defined(GRPC_POSIX_SOCKET) */

@ -1708,16 +1708,20 @@ static bool is_epoll_available() {
const grpc_event_engine_vtable *grpc_init_epollsig_linux( const grpc_event_engine_vtable *grpc_init_epollsig_linux(
bool explicit_request) { bool explicit_request) {
const char *error_msg = NULL;
/* If use of signals is disabled, we cannot use epoll engine*/ /* If use of signals is disabled, we cannot use epoll engine*/
if (is_grpc_wakeup_signal_initialized && grpc_wakeup_signal < 0) { if (is_grpc_wakeup_signal_initialized && grpc_wakeup_signal < 0) {
gpr_log(GPR_ERROR, "Skipping epollsig because use of signals is disabled.");
return NULL; return NULL;
} }
if (!grpc_has_wakeup_fd()) { if (!grpc_has_wakeup_fd()) {
gpr_log(GPR_ERROR, "Skipping epollsig because of no wakeup fd.");
return NULL; return NULL;
} }
if (!is_epoll_available()) { if (!is_epoll_available()) {
gpr_log(GPR_ERROR, "Skipping epollsig because epoll is unavailable.");
return NULL; return NULL;
} }
@ -1725,6 +1729,8 @@ const grpc_event_engine_vtable *grpc_init_epollsig_linux(
if (explicit_request) { if (explicit_request) {
grpc_use_signal(SIGRTMIN + 6); grpc_use_signal(SIGRTMIN + 6);
} else { } else {
gpr_log(GPR_ERROR,
"Skipping epollsig because uninitialized wakeup signal.");
return NULL; return NULL;
} }
} }
@ -1750,6 +1756,8 @@ const grpc_event_engine_vtable *grpc_init_epollsig_linux(
* NULL */ * NULL */
const grpc_event_engine_vtable *grpc_init_epollsig_linux( const grpc_event_engine_vtable *grpc_init_epollsig_linux(
bool explicit_request) { bool explicit_request) {
gpr_log(GPR_ERROR,
"Skipping epollsig becuase GRPC_LINUX_EPOLL is not defined.");
return NULL; return NULL;
} }
#endif /* defined(GRPC_POSIX_SOCKET) */ #endif /* defined(GRPC_POSIX_SOCKET) */

@ -1713,6 +1713,7 @@ static const grpc_event_engine_vtable vtable = {
const grpc_event_engine_vtable *grpc_init_poll_posix(bool explicit_request) { const grpc_event_engine_vtable *grpc_init_poll_posix(bool explicit_request) {
if (!grpc_has_wakeup_fd()) { if (!grpc_has_wakeup_fd()) {
gpr_log(GPR_ERROR, "Skipping poll because of no wakeup fd.");
return NULL; return NULL;
} }
if (!GRPC_LOG_IF_ERROR("pollset_global_init", pollset_global_init())) { if (!GRPC_LOG_IF_ERROR("pollset_global_init", pollset_global_init())) {

@ -172,12 +172,12 @@ void grpc_event_engine_init(void) {
gpr_free(strings[i]); gpr_free(strings[i]);
} }
gpr_free(strings); gpr_free(strings);
gpr_free(s);
if (g_event_engine == NULL) { if (g_event_engine == NULL) {
gpr_log(GPR_ERROR, "No event engine could be initialized"); gpr_log(GPR_ERROR, "No event engine could be initialized from %s", s);
abort(); abort();
} }
gpr_free(s);
} }
void grpc_event_engine_shutdown(void) { void grpc_event_engine_shutdown(void) {

Loading…
Cancel
Save