fat Sat, 29 Jan 2011 11:38:19 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=307842
Log: - Fixed bug #53434 (php-fpm slowlog now also logs the original request). Bug: http://bugs.php.net/53434 (Analyzed) More details for slow requests Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php.h U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_request.c U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_shm_slots.h U php/php-src/trunk/sapi/fpm/fpm/fpm_php.c U php/php-src/trunk/sapi/fpm/fpm/fpm_php.h U php/php-src/trunk/sapi/fpm/fpm/fpm_request.c U php/php-src/trunk/sapi/fpm/fpm/fpm_shm_slots.h Modified: php/php-src/branches/PHP_5_3/NEWS =================================================================== --- php/php-src/branches/PHP_5_3/NEWS 2011-01-29 10:13:24 UTC (rev 307841) +++ php/php-src/branches/PHP_5_3/NEWS 2011-01-29 11:38:19 UTC (rev 307842) @@ -110,6 +110,7 @@ . Enforce security in the fastcgi protocol parsing. (ef-lists at email dotde) . Fixed bug #53777 (php-fpm log format now match php_error log format). (fat) + . Fixed bug #53434 (php-fpm slowlog now also logs the original request). (fat) - Readline extension: . Fixed bug #53630 (Fixed parameter handling inside readline() function). Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php.c =================================================================== --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php.c 2011-01-29 10:13:24 UTC (rev 307841) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php.c 2011-01-29 11:38:19 UTC (rev 307842) @@ -160,6 +160,12 @@ } /* }}} */ +char *fpm_php_request_uri(TSRMLS_D) /* {{{ */ +{ + return (char *) SG(request_info).request_uri; +} +/* }}} */ + char *fpm_php_request_method(TSRMLS_D) /* {{{ */ { return (char *) SG(request_info).request_method; Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php.h =================================================================== --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php.h 2011-01-29 10:13:24 UTC (rev 307841) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php.h 2011-01-29 11:38:19 UTC (rev 307842) @@ -35,6 +35,7 @@ int fpm_php_init_child(struct fpm_worker_pool_s *wp); char *fpm_php_script_filename(TSRMLS_D); +char *fpm_php_request_uri(TSRMLS_D); char *fpm_php_request_method(TSRMLS_D); size_t fpm_php_content_length(TSRMLS_D); void fpm_php_soft_quit(); Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_request.c =================================================================== --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_request.c 2011-01-29 10:13:24 UTC (rev 307841) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_request.c 2011-01-29 11:38:19 UTC (rev 307842) @@ -26,6 +26,7 @@ slot = fpm_shm_slots_acquire(0, 0); slot->request_stage = FPM_REQUEST_ACCEPTING; fpm_clock_get(&slot->tv); + memset(slot->request_uri, 0, sizeof(slot->request_uri)); memset(slot->request_method, 0, sizeof(slot->request_method)); slot->content_length = 0; memset(slot->script_filename, 0, sizeof(slot->script_filename)); @@ -51,6 +52,7 @@ { TSRMLS_FETCH(); struct fpm_shm_slot_s *slot; + char *request_uri = fpm_php_request_uri(TSRMLS_C); char *request_method = fpm_php_request_method(TSRMLS_C); char *script_filename = fpm_php_script_filename(TSRMLS_C); @@ -58,6 +60,10 @@ slot->request_stage = FPM_REQUEST_INFO; fpm_clock_get(&slot->tv); + if (request_uri) { + cpystrn(slot->request_uri, request_uri, sizeof(slot->request_uri)); + } + if (request_method) { cpystrn(slot->request_method, request_method, sizeof(slot->request_method)); } @@ -136,8 +142,9 @@ fpm_trace_signal(child->pid); - zlog(ZLOG_WARNING, "[pool %s] child %d, script '%s' executing too slow (%d.%06d sec), logging", - child->wp->config->name, (int) child->pid, purified_script_filename, (int) tv.tv_sec, (int) tv.tv_usec); + zlog(ZLOG_WARNING, "[pool %s] child %d, script '%s' (request: \"%s %s\") executing too slow (%d.%06d sec), logging", + child->wp->config->name, (int) child->pid, purified_script_filename, slot_c.request_method, slot_c.request_uri, + (int) tv.tv_sec, (int) tv.tv_usec); } else #endif Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_shm_slots.h =================================================================== --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_shm_slots.h 2011-01-29 10:13:24 UTC (rev 307841) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_shm_slots.h 2011-01-29 11:38:19 UTC (rev 307842) @@ -19,6 +19,7 @@ enum fpm_request_stage_e request_stage; struct timeval accepted; struct timeval tv; + char request_uri[128]; char request_method[16]; size_t content_length; /* used with POST only */ char script_filename[256]; Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_php.c =================================================================== --- php/php-src/trunk/sapi/fpm/fpm/fpm_php.c 2011-01-29 10:13:24 UTC (rev 307841) +++ php/php-src/trunk/sapi/fpm/fpm/fpm_php.c 2011-01-29 11:38:19 UTC (rev 307842) @@ -160,6 +160,12 @@ } /* }}} */ +char *fpm_php_request_uri(TSRMLS_D) /* {{{ */ +{ + return (char *) SG(request_info).request_uri; +} +/* }}} */ + char *fpm_php_request_method(TSRMLS_D) /* {{{ */ { return (char *) SG(request_info).request_method; Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_php.h =================================================================== --- php/php-src/trunk/sapi/fpm/fpm/fpm_php.h 2011-01-29 10:13:24 UTC (rev 307841) +++ php/php-src/trunk/sapi/fpm/fpm/fpm_php.h 2011-01-29 11:38:19 UTC (rev 307842) @@ -35,6 +35,7 @@ int fpm_php_init_child(struct fpm_worker_pool_s *wp); char *fpm_php_script_filename(TSRMLS_D); +char *fpm_php_request_uri(TSRMLS_D); char *fpm_php_request_method(TSRMLS_D); size_t fpm_php_content_length(TSRMLS_D); void fpm_php_soft_quit(); Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_request.c =================================================================== --- php/php-src/trunk/sapi/fpm/fpm/fpm_request.c 2011-01-29 10:13:24 UTC (rev 307841) +++ php/php-src/trunk/sapi/fpm/fpm/fpm_request.c 2011-01-29 11:38:19 UTC (rev 307842) @@ -26,6 +26,7 @@ slot = fpm_shm_slots_acquire(0, 0); slot->request_stage = FPM_REQUEST_ACCEPTING; fpm_clock_get(&slot->tv); + memset(slot->request_uri, 0, sizeof(slot->request_uri)); memset(slot->request_method, 0, sizeof(slot->request_method)); slot->content_length = 0; memset(slot->script_filename, 0, sizeof(slot->script_filename)); @@ -51,6 +52,7 @@ { TSRMLS_FETCH(); struct fpm_shm_slot_s *slot; + char *request_uri = fpm_php_request_uri(TSRMLS_C); char *request_method = fpm_php_request_method(TSRMLS_C); char *script_filename = fpm_php_script_filename(TSRMLS_C); @@ -58,6 +60,10 @@ slot->request_stage = FPM_REQUEST_INFO; fpm_clock_get(&slot->tv); + if (request_uri) { + cpystrn(slot->request_uri, request_uri, sizeof(slot->request_uri)); + } + if (request_method) { cpystrn(slot->request_method, request_method, sizeof(slot->request_method)); } @@ -136,8 +142,9 @@ fpm_trace_signal(child->pid); - zlog(ZLOG_WARNING, "[pool %s] child %d, script '%s' executing too slow (%d.%06d sec), logging", - child->wp->config->name, (int) child->pid, purified_script_filename, (int) tv.tv_sec, (int) tv.tv_usec); + zlog(ZLOG_WARNING, "[pool %s] child %d, script '%s' (request: \"%s %s\") executing too slow (%d.%06d sec), logging", + child->wp->config->name, (int) child->pid, purified_script_filename, slot_c.request_method, slot_c.request_uri, + (int) tv.tv_sec, (int) tv.tv_usec); } else #endif Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_shm_slots.h =================================================================== --- php/php-src/trunk/sapi/fpm/fpm/fpm_shm_slots.h 2011-01-29 10:13:24 UTC (rev 307841) +++ php/php-src/trunk/sapi/fpm/fpm/fpm_shm_slots.h 2011-01-29 11:38:19 UTC (rev 307842) @@ -19,6 +19,7 @@ enum fpm_request_stage_e request_stage; struct timeval accepted; struct timeval tv; + char request_uri[128]; char request_method[16]; size_t content_length; /* used with POST only */ char script_filename[256];
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php