[PATCH] bug: some event from parent might be triggered by children

From: Date: Wed, 16 Dec 2009 15:33:55 +0000
Subject: [PATCH] bug: some event from parent might be triggered by children
Groups: php.internals 
Request: Send a blank email to internals+get-46445@lists.php.net to get a copy of this message
hi tony, this patch correct a behaviour that could happened randomly, depending on the event lib used (epoll, poll, kqueue, ...). There is some case in which an event created by the parent process can be triggered in a child. This patch corrects this by checking if fpm_globals.is_child is set and return directly in this case. ++ Jerome

Index: sapi/fpm/fpm/fpm_process_ctl.c =================================================================== --- sapi/fpm/fpm/fpm_process_ctl.c (révision 292207) +++ sapi/fpm/fpm/fpm_process_ctl.c (copie de travail) @@ -296,6 +296,11 @@ { struct fpm_worker_pool_s *wp; + /* If it's child, return immediately */ + if (fpm_globals.is_child) { + return; + } + for (wp = fpm_worker_all_pools; wp; wp = wp->next) { int terminate_timeout = wp->config->request_terminate_timeout; int slowlog_timeout = wp->config->request_slowlog_timeout; @@ -316,6 +321,11 @@ struct fpm_child_s *last_idle_child = NULL; int i; + /* If it's child, return immediately */ + if (fpm_globals.is_child) { + return; + } + for (wp = fpm_worker_all_pools; wp; wp = wp->next) { struct fpm_child_s *child; int idle = 0; @@ -398,6 +408,11 @@ struct timeval tv = { .tv_sec = 0, .tv_usec = 130000 }; struct timeval now; + /* If it's child, return immediately */ + if (fpm_globals.is_child) { + return; + } + if (which == EV_TIMEOUT) { evtimer_del(&heartbeat); fpm_clock_get(&now); @@ -415,6 +430,11 @@ struct timeval tv = { .tv_sec = 0, .tv_usec = FPM_IDLE_SERVER_MAINTENANCE_HEARTBEAT }; struct timeval now; + /* If it's child, return immediately */ + if (fpm_globals.is_child) { + return; + } + if (which == EV_TIMEOUT) { evtimer_del(&heartbeat); fpm_clock_get(&now); Index: sapi/fpm/fpm/fpm_stdio.c =================================================================== --- sapi/fpm/fpm/fpm_stdio.c (révision 292207) +++ sapi/fpm/fpm/fpm_stdio.c (copie de travail) @@ -84,6 +84,11 @@ int in_buf = 0; int res; + /* If it's child, return immediately */ + if (fpm_globals.is_child) { + return; + } + #if 0 zlog(ZLOG_STUFF, ZLOG_DEBUG, "child %d said %s", (int) child->pid, is_stdout ? "stdout" : "stderr"); #endif
« previous php.internals (#46445) next »