Re: svn commit: r1451478 - /httpd/httpd/trunk/server/util_script.c
On Tuesday 19 March 2013, Marion Christophe JAILLET wrote: Le 18/03/2013 22:43, Stefan Fritsch a écrit : On Thursday 14 March 2013, you wrote: BTW, I tried to activate pool debug with using |-enable-pool-debug=all but the server crashes while starting |on my test machine. Do you know if it is supposed to work (and I do something wrong) or no one uses it with httpd ? I am sure that I have used at least parts of the pool debugging with httpd in the past. I will try it again when I have some time. Have you tried using prefork? IIRC, there were some threading issues that were caught by full pool debugging. Cheers, Stefan I tried only with event and worker. in both cases, I tried to avoid multithreading issue by setting: ThreadsPerChild 1 MaxRequestWorkers 1 I'll do more testing this evening. Were you using trunk? If yes, maybe this helps: http://svn.apache.org/r1459992
Re: svn commit: r1451478 - /httpd/httpd/trunk/server/util_script.c
Yes, i work and test on trunk. I'll give it a try. Thx CJ Le 22/03/2013 22:14, Stefan Fritsch a écrit : On Tuesday 19 March 2013, Marion Christophe JAILLET wrote: Le 18/03/2013 22:43, Stefan Fritsch a écrit : On Thursday 14 March 2013, you wrote: BTW, I tried to activate pool debug with using |-enable-pool-debug=all but the server crashes while starting |on my test machine. Do you know if it is supposed to work (and I do something wrong) or no one uses it with httpd ? I am sure that I have used at least parts of the pool debugging with httpd in the past. I will try it again when I have some time. Have you tried using prefork? IIRC, there were some threading issues that were caught by full pool debugging. Cheers, Stefan I tried only with event and worker. in both cases, I tried to avoid multithreading issue by setting: ThreadsPerChild 1 MaxRequestWorkers 1 I'll do more testing this evening. Were you using trunk? If yes, maybe this helps: http://svn.apache.org/r1459992
Re: svn commit: r1451478 - /httpd/httpd/trunk/server/util_script.c
I still have the same issue with mpm worker but it works with prefork. It is enough for what I want to do. Thx CJ
Re: svn commit: r1451478 - /httpd/httpd/trunk/server/util_script.c
Le 18/03/2013 22:43, Stefan Fritsch a écrit : On Thursday 14 March 2013, you wrote: BTW, I tried to activate pool debug with using |-enable-pool-debug=all but the server crashes while starting on my test machine. Do you know if it is supposed to work (and I do something wrong) or no one uses it with httpd ? I am sure that I have used at least parts of the pool debugging with httpd in the past. I will try it again when I have some time. Have you tried using prefork? IIRC, there were some threading issues that were caught by full pool debugging. Cheers, Stefan I tried only with event and worker. in both cases, I tried to avoid multithreading issue by setting: ThreadsPerChild 1 MaxRequestWorkers 1 I'll do more testing this evening. Best regards, CJ
Re: svn commit: r1451478 - /httpd/httpd/trunk/server/util_script.c
On Thursday 14 March 2013, you wrote: BTW, I tried to activate pool debug with using |-enable-pool-debug=all but the server crashes while starting on my test machine. Do you know if it is supposed to work (and I do something wrong) or no one uses it with httpd ? I am sure that I have used at least parts of the pool debugging with httpd in the past. I will try it again when I have some time. Have you tried using prefork? IIRC, there were some threading issues that were caught by full pool debugging. Cheers, Stefan
Re: svn commit: r1451478 - /httpd/httpd/trunk/server/util_script.c
Note that there is some macro magic in http_log.h that does this automatically on C99 compilers. There is nothing wrong with doing the check explicitly, and it is definitely a good idea if the saved function call is very expensive. But in general other improvements may have more impact and therefore be a better use of your time. But of course that's your choice ;) On Fri, 1 Mar 2013, jaillet...@apache.org wrote: Author: jailletc36 Date: Fri Mar 1 06:33:40 2013 New Revision: 1451478 URL: http://svn.apache.org/r1451478 Log: Avoid some memory allocation on error path in 'http2env' if TRACE1 logging is not activated Avoid a function ca Modified: httpd/httpd/trunk/server/util_script.c Modified: httpd/httpd/trunk/server/util_script.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_script.c?rev=1451478r1=1451477r2=1451478view=diff == --- httpd/httpd/trunk/server/util_script.c (original) +++ httpd/httpd/trunk/server/util_script.c Fri Mar 1 06:33:40 2013 @@ -73,9 +73,10 @@ static char *http2env(request_rec *r, co *cp++ = '_'; } else { -ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, - Not exporting header with invalid name as envvar: %s, - ap_escape_logitem(r-pool, w)); +if (APLOGrtrace1(r)) +ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, +Not exporting header with invalid name as envvar: %s, +ap_escape_logitem(r-pool, w)); return NULL; } } @@ -594,9 +595,10 @@ AP_DECLARE(int) ap_scan_script_header_er Invalid status line from script '%s': %.30s, apr_filepath_name_get(r-filename), l); else -ap_log_rerror(SCRIPT_LOG_MARK, APLOG_TRACE1, 0, r, - Status line from script '%s': %.30s, - apr_filepath_name_get(r-filename), l); +if (APLOGrtrace1(r)) + ap_log_rerror(SCRIPT_LOG_MARK, APLOG_TRACE1, 0, r, + Status line from script '%s': %.30s, + apr_filepath_name_get(r-filename), l); r-status_line = apr_pstrdup(r-pool, l); } else if (!strcasecmp(w, Location)) {
Re: svn commit: r1451478 - /httpd/httpd/trunk/server/util_script.c
My goal was to check for useless memory allocation when calling logging function. Logging with TRACE is unlikely to output something on a production machine. However, function called as parameters of the logging function will still be called. I made a check on the whole source code to check for useless memory allocation as a side effect of logging. I found the one below, in an error path. It is part of the time I'm spending to analyze memory allocation and use done by httpd. I've modified apr_palloc and so on to give me some feedback and I'm looking at it. With current trunk, with a light configuration and a server configured to be single threaded, 11541 calls to apr_palloc, for a total of 4,4 Mo, are performed during stat-up. According to my configuration, I find it high, but ok, why not, it is just start-up For processing a single request like http://localhosr/foo, 254 new calls are done for a total of 15 ko, mostly in the request pool. Reducing it to fit in only one 8k, if possible, would be nice. It would avoid the pool to allocate more memory. Here is my goal. BTW, I tried to activate pool debug with using |-enable-pool-debug=all but the server crashes while starting on my test machine. Do you know if it is supposed to work (and I do something wrong) or no one uses it with httpd ? I haven't saved details about it but it would be easy to reproduce if you are interested. |CJ Le 13/03/2013 22:26, Stefan Fritsch a écrit : Note that there is some macro magic in http_log.h that does this automatically on C99 compilers. There is nothing wrong with doing the check explicitly, and it is definitely a good idea if the saved function call is very expensive. But in general other improvements may have more impact and therefore be a better use of your time. But of course that's your choice ;) On Fri, 1 Mar 2013, jaillet...@apache.org wrote: Author: jailletc36 Date: Fri Mar 1 06:33:40 2013 New Revision: 1451478 URL: http://svn.apache.org/r1451478 Log: Avoid some memory allocation on error path in 'http2env' if TRACE1 logging is not activated Avoid a function ca Modified: httpd/httpd/trunk/server/util_script.c Modified: httpd/httpd/trunk/server/util_script.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_script.c?rev=1451478r1=1451477r2=1451478view=diff == --- httpd/httpd/trunk/server/util_script.c (original) +++ httpd/httpd/trunk/server/util_script.c Fri Mar 1 06:33:40 2013 @@ -73,9 +73,10 @@ static char *http2env(request_rec *r, co *cp++ = '_'; } else { -ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, - Not exporting header with invalid name as envvar: %s, - ap_escape_logitem(r-pool, w)); +if (APLOGrtrace1(r)) +ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, +Not exporting header with invalid name as envvar: %s, +ap_escape_logitem(r-pool, w)); return NULL; } }
Re: svn commit: r1451478 - /httpd/httpd/trunk/server/util_script.c
Le 01/03/2013 11:43, Guenter Knauf a écrit : Hi Christophe, Am 01.03.2013 08:00, schrieb Christophe JAILLET: To quick... you can fix the svn log with: svn propedit -r 1451478 --revprop svn:log Gün. Thanks, done. CJ
Re: svn commit: r1451478 - /httpd/httpd/trunk/server/util_script.c
Hi Christophe, Am 01.03.2013 08:00, schrieb Christophe JAILLET: To quick... you can fix the svn log with: svn propedit -r 1451478 --revprop svn:log Gün.
Re: svn commit: r1451478 - /httpd/httpd/trunk/server/util_script.c
To quick... Le 01/03/2013 07:33, jaillet...@apache.org a écrit : Author: jailletc36 Date: Fri Mar 1 06:33:40 2013 New Revision: 1451478 URL: http://svn.apache.org/r1451478 Log: Avoid some memory allocation on error path in 'http2env' if TRACE1 logging is not activated Avoid a function ca ...call to 'apr_filepath_name_get' which ends up to a strrchr call, if TRACE1 logging is not activated Modified: httpd/httpd/trunk/server/util_script.c Modified: httpd/httpd/trunk/server/util_script.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_script.c?rev=1451478r1=1451477r2=1451478view=diff == --- httpd/httpd/trunk/server/util_script.c (original) +++ httpd/httpd/trunk/server/util_script.c Fri Mar 1 06:33:40 2013 @@ -73,9 +73,10 @@ static char *http2env(request_rec *r, co *cp++ = '_'; } else { -ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, - Not exporting header with invalid name as envvar: %s, - ap_escape_logitem(r-pool, w)); +if (APLOGrtrace1(r)) +ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, +Not exporting header with invalid name as envvar: %s, +ap_escape_logitem(r-pool, w)); return NULL; } } @@ -594,9 +595,10 @@ AP_DECLARE(int) ap_scan_script_header_er Invalid status line from script '%s': %.30s, apr_filepath_name_get(r-filename), l); else -ap_log_rerror(SCRIPT_LOG_MARK, APLOG_TRACE1, 0, r, - Status line from script '%s': %.30s, - apr_filepath_name_get(r-filename), l); +if (APLOGrtrace1(r)) + ap_log_rerror(SCRIPT_LOG_MARK, APLOG_TRACE1, 0, r, + Status line from script '%s': %.30s, + apr_filepath_name_get(r-filename), l); r-status_line = apr_pstrdup(r-pool, l); } else if (!strcasecmp(w, Location)) {