About mod_status and the use of ‘times ’ function information to calculated the apache instance cpu load…

2010-08-12 Thread Mathieu CARBONNEAUX
Hi,

I’m working on more instrumentation oriented version of mod_status module and i 
found a problem on ‘times’ function use...

Actualy each worker update ‘worker_score-times’ struct at each connection.
When the child process die, at the next request of a new child with the same 
worker position this value are reinitialised to zero in scoreboard…

This ‘times’ value are the cumulated consumed cpu used time (number of tick 
used from the processus start) from start of the processus, to calculate the 
cpu percent used you must know the real execution time (processus uptime) of 
the process who consumed this cpu time…

But… Actualy in the scoreboard you have only the last request time  (apr_time_t 
worker_score-stop/start) and the instances uptime (now time– 
globale_score-restart_time)… not the processus uptime (now time – child 
restart time)…

Actualy the cpu load of apache instance is calculated on comulated of all 
worker/child cpu tick of the apache instance divide by the apache instante up 
times…
But this up time that are not the cumulated real execution time (uptime of each 
worker/child) of all active worker/child but the up time of the apache instance 
!!!

With that way of calculating, more the apache instance run are long more this 
load are completely usefull…
Exemple : apache 3h of 70% cpu load for one day apache running ~= 9% of apache 
instance cpu load at the end of the day… 

An apache instance are not using CPU a the same load all the time, they depand 
on the client request demand ! What is more interesting is to detect when the 
cpu load is high !
With that way of calulating the load you don’t be able to see this instant load 
and you are no be abel to detect this apache instance high cpu load!


- The first solution i imagine : is to adding a new field (ex : apr_time_t 
worker_score-restart_time) on scoreboard ‘worker_score’ structure that are 
updated at child start, in child_init (ap_logs_child_init in log.c) phase or in 
ap_update_child_status_from_indexes (scoreboard.c)  with status SERVER_STARTING.

- The seconde solution (more advanced/complex) : is to adding also a new field 
(ex : apr_time_t worker_score-last_update_time) that are updated at now time 
at each ‘times’ is call in ‘ap_update_child_status_from_indexes’ function. And 
store now the ‘times’ delta (now ‘times’ – worker_score-times) in a new 
field worker_score-times_delta. With that you are abel to musurate more 
instantaneous apache cpu load… But you add two new field and one apr_time_now 
call at each ‘times’ call in ‘ap_update_child_status_from_indexes’ function.


Without one of this solution the call to ‘times’ function in scoreboard are 
actualy completly usefull…

And to have real total cpu load from apache instance start, they need to add a 
new field (ex : worker_score-total_times) (like access_count and bytes_served 
field) in worker_score that to be updated at worker ending (in 
ap_update_child_status_from_indexes(scoreboard.c) at status SERVER_DEAD or 
SERVER_GRACEFUL ?!) to commulated in, the last ‘times’ value.

Any other sugestion/remark/question ?! 

If your ok with thats modifications, i can do a patch proposal for that.

Best regard,
Mathieu


Re: High security

2008-05-07 Thread Mathieu CARBONNEAUX

hi all,

sorry to enter so later in the discution...

i'm ok with you torsten (+1), i think is the good place to do it, think 
adding hook like pre_childinit that occure before unixd_setup_child


remove the root rigth (in child_init you lost the root right juste 
before) can be more generic way. and after use this hook to do 
implemente the chroot option as loadable module.
and i think can be usefull for other module to have chance to use root 
right juste before is removed in child_init...


existe other implementation of chroot in apache and i think many 
interesting hints to use chroot in apache are in the page of mod_chroot: 
http://core.segfault.pl/~hobbit/mod_chroot/caveats.html

i think is interesting to add some of this in the documentation also...

and loadfile of libgcc_s.so.1 is only needed in threaded mpm version.
because the thread lib use some symbole of libgcc_s.so.1 that are 
autoloaded in child when create thread after unixd_setup_child occure...


i've made modified version (at 02/08) of mod_chroot that work like your 
modification (chrooting juste before seting up setuid in the


child) but without modifying apache code and working with ap 2.0 and 2.2...

it work like that, i save the unixd_config.user_id in pre_mpm hook, and 
force it to 0 (root), in that way in child_init root your are root


(unixd_setup_child skip changing user_id)!
like i can do the chroot in child_init hook, and restore 
unixd_config.user_id and redo unixd_setup_child to remove root right.


i think an other modification must be done to be complete... is to 
modify the way DocumentRoot global context cmd check if the path is


directory or not, will be very good, to check document root path in 
chroot directory relative in place of server_root if chroot option is


activated.

without that modification you must have DocumentRoot in the chroot path 
and outside the chroot path like that :
 if chroot dir is /var/chroot and globale document root to 
/var/chroot/www in httpd.conf

 your globale document root point to  /var/chroot/www/var/chroot/www.

with that modification you can set globale document root in the jail 
path without problem...


a work around exist... using documentroot in virtualhost...
in vhost you can  use path in the jail without problem because 
documentroot cmd in the jail are executed
when vhost are checked... far later from the point the chroot occure 
(juste before unixd_setup_child)...


in that way can be possible to set globale DocumentRoot to same dir of 
chroot, and use only vhost to specify Document root directory...


but is not completely transparent because you must set a fake globale 
document root that exist ouside the jail and you are obliged to use


vhost...

in my mod_chroot modification in correcte all path transparantly on the 
fly (in translate hook, and map_to_storage hook) to work around


this (to do it without modification in apache code!)...but is more havy 
modification... and more risky...


Regards,
Mathieu


   
   *From:* Torsten Foertsch
   *Sent:* Sat, 26 Jan 2008 08:44:17 +0100

   On Fri 25 Jan 2008, Nick Kew wrote:
   A
  compromise might be to create a chroot hook and allow module
  developers to use it. This would shift the support burden somewhat
  from the core Apache team to those willing to engage the users
  providing support.

 Isn't that basically the status quo (mod_security presumably hooks it
 in at post_config?)

   Sometimes I have missed a ChildPrivilegedInit hook that is run
   between fork()
   and dropping privileges in the worker. That would be the right place to
   chroot() I think.

   Torsten



Re: [EMAIL PROTECTED] Re: mod_memcache??

2007-02-05 Thread Mathieu CARBONNEAUX
interesting idea !!!

i use memcache (with libmemcache) in my from auth module 
(http://authmemcookie.sourceforge.net/)!
my next step is to try to use apr_memcache in place of libmemcache... (by my 
primary goal is to make posible to use my module on old 2.0 apache version that 
user older aprapr-util than 0.9.5...)

but your addition while simplify the use of apr_memcache!

if i anderstand your idea is to developpe module to make apr_memcache 
connection pool like mod_dbi_pool 
(http://www.outoforder.cc/projects/apache/mod_dbi_pool/) ?

Regards,
Mathieu

  _  

From: Garrett Rooney [mailto:[EMAIL PROTECTED]
To: dev@httpd.apache.org
Sent: Mon, 05 Feb 2007 16:04:03 +0100
Subject: [EMAIL PROTECTED] Re: mod_memcache??

On 2/2/07, Brian Akins [EMAIL PROTECTED] wrote:
 I have a need to write a generic way to integrate  apr_memcache into httpd.
 Basically, I have several otehr modules taht use memcached as backend and want
 to combine the boring stuff into a central place, ie configuration, stats,
 etc.  We talked a little on list about this a few months ago, but noone ever 
 did
 anything.   Is anyone else interested in this?  Has anyone did this?

 Basically I was thinking there would be a single funtion:

 apr_status_t ap_memcache_client(apr_memcache_t **mc)

 which would simply give the user an client to use with normal apr_memcache
 functions.  The module could create the underlying mc at post_config.

 Basically, mod_memcache could have this config:

 MemCacheServer memcache1.turner.com:9020 min=8 smax=16 max=64 ttl=5
 MemCacheServer memcache4.turner.com:9020 min=8 smax=16 max=64 ttl=5
 MemCacheServer memcache10.turner.com:9020 min=8 smax=16 max=64 ttl=5

 or whatever.  This would end the config duplication between various modules.
 This module could also add memcache stats to /server-status

 Comments?

Seems useful to me.

-garrett
  

Re: vote on concept of ServerTokens Off

2006-12-07 Thread Mathieu CARBONNEAUX
Hi,

what the difference with no header and Header =  Server: Apache without 
version with prod args of servertoken...
if is to hide apache version only there no need to modify ServerToken 
directive...
if is to hide apache completly ok...it's other problem...

but a security level i'm not sure they add serius difference...

and for the notoriety of apache vs other web server is very importante to have 
statistic...
beceause enterprise make disision to use opensource on the fact who are wheel 
known and used...
and statistic is the most powerfull way to acheve this...

Best Regards,
Mathieu

how to modify Document Root from module...

2006-11-26 Thread Mathieu CARBONNEAUX
hi,

i'm developping a module and i need to modify ap_document_root dynamicaly in my 
module

i've tryed to modifiy ap_document_root in core_module but it's reset a each 
request...
i've found to do it in modifying it in translate hook work.

core_server_config *corecfg = 
ap_get_module_config(ap_server_conf-module_config, core_module);
corecfg-ap_document_root=my new value;

but not completly fine...
if found they are modify in merge config...
il while try to hook merge config to modify also in merge config...

but some module dont see the modification have made, and i must modify also the 
configuration tree to reflect the core module config...


if you know other way to do it!?

Ragards,
Mathieu

Re: [EMAIL PROTECTED] Re: how to modify Document Root from module...

2006-11-26 Thread Mathieu CARBONNEAUX
the idea is to fake document root after they are setted when apache 
configuration are readed...
the idea is to correct the document root in chroot jail maked in child init...

Best Regards,
Mathieu
  _  

From: Nick Kew [mailto:[EMAIL PROTECTED]
To: dev@httpd.apache.org
Sent: Mon, 27 Nov 2006 00:14:15 +0100
Subject: [EMAIL PROTECTED] Re: how to modify Document Root from module...

On Sun, 26 Nov 2006 23:55:39 +0100
Mathieu CARBONNEAUX [EMAIL PROTECTED] wrote:

 hi,
 
 i'm developping a module and i need to modify ap_document_root
 dynamicaly in my module

No you don't!  Define another variable you can manipulate.
Don't mess with apache's standard vars!


-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/
  

Re: [EMAIL PROTECTED] Re: how to modify Document Root from module...

2006-11-26 Thread Mathieu CARBONNEAUX
the idea is to fake document root after chrooting apache.

after reading configuration and setting document root, in child init i make 
chroot to the actual document root, 
and after i whant to correct document root to reflect the new document root 
/...

without that you must have document root that exist in chroot and outside the 
chroot... 
because apache check if document root is directory at configuration stage...

Best Regards,
Mathieu
  _  

From: Nick Kew [mailto:[EMAIL PROTECTED]
To: dev@httpd.apache.org
Sent: Mon, 27 Nov 2006 00:14:15 +0100
Subject: [EMAIL PROTECTED] Re: how to modify Document Root from module...

On Sun, 26 Nov 2006 23:55:39 +0100
Mathieu CARBONNEAUX [EMAIL PROTECTED] wrote:

 hi,
 
 i'm developping a module and i need to modify ap_document_root
 dynamicaly in my module

No you don't!  Define another variable you can manipulate.
Don't mess with apache's standard vars!


-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/
  

Re: [EMAIL PROTECTED] Re: How the PHP works?

2006-11-21 Thread Mathieu CARBONNEAUX
php is an interpreter that can be embedable in many web server(and other thing) 
and can be usable a command line interpreter...

and is the php team that make the embedading of php in each server...

each embeding is named sapi, and go in sapi (Serveur API) directory of PHP, and 
you while see some implementation for differente serveur possible with php 
interpreter...

the sapi for apache are:


* apache   = apache v1 implementation

* apache2filter = apache v2 implementation as filter (see filter 
implementation of apache module in apache dev docs)

* apache2handler = apache v2 implementation as handler (see handler 
implementation of apache module in apache dev docs)

* apache_hooks = experimental implémentation like mod_perl, that can be abale 
to hook programaticly in php all hookable hook of apache!!


all php apache implementation use hook to handler or filter to apache.

all intepreter use handler or filter hook to embed in apache...

use hook in general to make module for apache

to know how php integration work you must anderstand how to make module in 
apache, and for this go to apache dev docs...to anderstand how filter and 
handler hook work...

http://httpd.apache.org/docs/2.0/developer/documenting.html


Regards,
Mathieu

  _  

From: Andy Armstrong [mailto:[EMAIL PROTECTED]
To: dev@httpd.apache.org
Sent: Mon, 13 Nov 2006 18:09:56 +0100
Subject: [EMAIL PROTECTED] Re: How the PHP works?

Toni - this isn't really the right list for your question - this list  
is concerned with the development of Apache itself.

The majority of the PHP code is not Apache specific and then there's  
an Apache loadable module that interfaces with the PHP engine.

On 13 Nov 2006, at 16:43, Toni Pizà wrote:

 Hello world!

 I know that the question isn't simple, but .. how works the php
 integration in Apache? Do you have implemented an php interpreter, or
 simply use an existent interpreter? Which files/functions do this
 work?

 As you can see, I am lost, and I don't know where to search. Excuse me
 if my question is an stupid question :P

 -- 
 Two of the most famous products of Berkeley are LSD and Unix. I don't
 think that this is a coincidence.
 http://servomac.blogspot.com


-- 
Andy Armstrong, hexten.net

  

Re: [EMAIL PROTECTED] Re: How the PHP works?

2006-11-16 Thread Mathieu CARBONNEAUX
and libneon also: http://www.webdav.org/neon/

Mathieu
  _  

From: Joachim Zobel [mailto:[EMAIL PROTECTED]
To: dev@httpd.apache.org
Sent: Mon, 13 Nov 2006 22:54:35 +0100
Subject: [EMAIL PROTECTED] Re: How the PHP works?

Am Montag, den 13.11.2006, 21:39 +0100 schrieb Toni Pizà:
 I will try to read the code of mod_php in ordrer to understand how the
 CGI relates the server web and the php interpreter!

If you want to look at a webservers source code to understand what a
webserver does, apache is too complex. Try a simple one:

http://sites.inka.de/sites/bigred/sw/tinyhttpd.html

Sincerely,
Joachim


  

Re: [EMAIL PROTECTED] Re: child_init hook...

2006-10-23 Thread Mathieu CARBONNEAUX
After investigating in the apache source...
I see that is not possible to do that, because reload occur in main infinite 
loop...
And the ap_read_config occur before any hook in reload phase, and the next 
available hook is ap_run_pre_config...

At this point it's too late to re-chroot to the original root dir...

Code extract of ./server/main.c :
for (;;) {
  ...
server_conf = ap_read_config(process, ptemp, confname, ap_conftree);
if (ap_run_pre_config(pconf, plog, ptemp) != OK) {
  ...
if (ap_run_open_logs(pconf, plog, ptemp, server_conf) != OK) {
  ...
if (ap_run_post_config(pconf, plog, ptemp, server_conf) != OK) {
  ...
ap_run_optional_fn_retrieve();

if (ap_mpm_run(pconf, plog, server_conf))
  ...
}

And child_init hook occur in ap_mpm_run when it fire new child...

When ap_mqm_run loop receive reload signal they exit from ap_mqm_run and the 
main loop restart...

To make re-chroot the only way I see is to add new hook in start (or after exit 
of the ap_mpm_run with check of the reload status) of the main infinit loop 
like pre_reload for example.

Thanks,
Mathieu

From: Mathieu CARBONNEAUX [mailto:[EMAIL PROTECTED]
To: dev@httpd.apache.org
Sent: Sun, 22 Oct 2006 16:04:47 +0200
Subject: Re: [EMAIL PROTECTED] Re: child_init hook...

if i do :
  fchdir(d); chroot(.);
in pre_config or open_logs hook??

i while try it that...

From: Mathieu CARBONNEAUX [mailto:[EMAIL PROTECTED]
To: dev@httpd.apache.org
Sent: Sun, 22 Oct 2006 16:00:25 +0200
Subject: Re: [EMAIL PROTECTED] Re: child_init hook...

very interesting !!!

il while try to implement on base of mod_chroot module...

ok i imagine that make :
    d=open(/, O_RDONLY); chroot(/new/root);
in post_config hook

and the close in child_init...

but how to make reload phase... what is the good hook to do that! or how to 
detect reload...

Thanks,
Mathieu

In the main apache:
d=open(/, O_RDONLY); chroot(/new/root);

At reload time:
fchdir(d); chroot(.); do_reload(); chroot(/new/root);

At child_init:
close(d);

Torsten





Re: [EMAIL PROTECTED] Re: child_init hook...

2006-10-23 Thread Mathieu CARBONNEAUX




very interesting !!!il while try to implement on base of mod_chroot module...ok i imagine that make : d=open("/", O_RDONLY); chroot("/new/root");in post_config hookand the close in child_init...but how to make reload phase... what is the good hook to do that! or how to detect reload...Thanks,MathieuIn the main apache:d=open("/", O_RDONLY); chroot("/new/root");At reload time:fchdir(d); chroot("."); do_reload(); chroot("/new/root");At child_init:close(d);Torsten


Re: [EMAIL PROTECTED] Re: child_init hook...

2006-10-23 Thread Mathieu CARBONNEAUX




if i do : fchdir(d); chroot(".");in pre_config or open_logs hook??i while try it that...From: Mathieu CARBONNEAUX [mailto:[EMAIL PROTECTED]To: dev@httpd.apache.orgSent: Sun, 22 Oct 2006 16:00:25 +0200Subject: Re: [EMAIL PROTECTED] Re: child_init hook...
very interesting !!!il while try to implement on base of mod_chroot module...ok i imagine that make : d=open("/", O_RDONLY); chroot("/new/root");in post_config hookand the close in child_init...but how to make reload phase... what is the good hook to do that! or how to detect reload...Thanks,MathieuIn the main apache:d=open("/", O_RDONLY); chroot("/new/root");At reload time:fchdir(d); chroot("."); do_reload(); chroot("/new/root");At child_init:close(d);Torsten



child_init hook...

2006-10-20 Thread Mathieu CARBONNEAUX




hi,i'm searching about to ameliorate chroot funciton of "mod_chroot" and "mod_security" module to be working normaly with apache reload.the probleme is that the chroot occure in apache main processes who control child forking...and not in the start of the child (after the fork)...because of that the chroot are permanante... and the apache main process canot be abel to reload configuration file that are outside of the chroot...my first idea is to make chroot in child_init hook in place of post_config... but...they dont work...and when have analysed the apache code have found why no working:the child_init hook occure after the setuid (unixd_setup_child) and after that is not possible to make chroot beceause at this point dont have the nessery right to do that...my question is how to make possible root action in child init phase? displacing the hook before "unixd_setup_child" ? but what is the impact of this ?adding a other hook placed before "unixd_setup_child" ?i'm interested of idea to resolve this!Thanks,MathieuFrom: Eric Covener [mailto:[EMAIL PROTECTED]To: dev@httpd.apache.orgSent: Fri, 20 Oct 2006 13:30:12 +0200Subject: [EMAIL PROTECTED] Re: module that doesn't want to be shared.On 10/20/06, Jean-frederic Clere [EMAIL PROTECTED] wrote: On Fri, 2006-10-20 at 11:53 +0200, Jean-frederic Clere wrote:  Hi,   I have added a modules to httpd-trunk but I have not able to get it  shared. (modules.mk shared = is empty!). I have removed my copy of the repos, checkout again copy back my module files. And now it works.FWIW I've seen this happen if you have a 2nd copy of a moduledirectory  (as in cp -r modules/debug modules/debug.bak) in yoursource tree.-- Eric Covener[EMAIL PROTECTED]


Re: [EMAIL PROTECTED] Re: mod_proxy_balancer/mod_proxy_ajp TODO

2006-06-21 Thread Mathieu CARBONNEAUX




like alteon load balancer from nortel... they provide health check for many protocole...for http is only simple get to backend... and on the backend you must provide a responde this check (ex:statics file)...you can define how many ping after how it consider the backend dead...and how many seconds between ping...From: Jim Jagielski [mailto:[EMAIL PROTECTED]To: dev@httpd.apache.orgSent: Mon, 19 Jun 2006 23:02:11 +0200Subject: [EMAIL PROTECTED] Re: mod_proxy_balancer/mod_proxy_ajp TODORuediger Pluem wrote:  +1. Just one thought: I think it would be useful to have this 'health check' approach somewhat generic so that we can implement the call to it inside mod_proxy and its connection pooling itself (e.g. with providers supplied by schema handlers / modules). For AJP this would be CPING/CPONG of course and mod_proxy itself could offer a generic TCP connection 'health check' provider that simply checks the status of a TCP connection as far as this is possible without reading or writing data. This would be a very generic provider. Other protocol handlers could define other (better) protocol specific providers and just plug them in. Agreed. Making a generic hearbeat interface that could vary dependingon the actual protocol would be v. cool. So for AJP, CPING/CPONG,for HTTP some sort of generic TRACE (or HEAD)...-- ===   Jim Jagielski   [|]   [EMAIL PROTECTED]   [|]   http://www.jaguNET.com/	"If you can dodge a wrench, you can dodge a ball."


Re: [EMAIL PROTECTED] Re: mod_proxy_balancer/mod_proxy_ajp TODO

2006-06-21 Thread Mathieu CARBONNEAUX




why not add proxy hook like scheme handler do to that ?From: Ruediger Pluem [mailto:[EMAIL PROTECTED]To: dev@httpd.apache.orgSent: Mon, 19 Jun 2006 23:04:55 +0200Subject: [EMAIL PROTECTED] Re: mod_proxy_balancer/mod_proxy_ajp TODOOn 06/19/2006 10:23 PM, Mladen Turk wrote: Henri Gomez wrote:  Good to see that PING/PONG got such a good response here. When I added this to mod_jk it was just a quick way to detect hang JVMs but it seems to many on the TC-DEV not a very usefull feature :)  And may thanks for such a great idea Henri ;) Actually its a great way to detect all those busy/broken/hanged/disconnected servers.  I'm not sure how we could add that feature to the http/https protocol, the Rudiger suggested.To be honest I currently have no generic idea how to do this withoutsupport from the backend. My point was more about that I would loveto see this health check integrated into the generic code of mod_proxyand its connection pooling and let the protocol modules provide the codethat actually does the dirty work of the protocol specific aspects of such ahealth check. This would make it easy to add health checks for other protocols/ add better ones for protocols with existing ones. As said currently I wouldonly see two health check providers:- CPING/CPONG for AJP.- A generic TCP connection check.But this would be open to further bright ideas.RegardsRüdiger


Re: [EMAIL PROTECTED] Re: mod_proxy_balancer/mod_proxy_ajp TODO

2006-06-21 Thread Mathieu CARBONNEAUX




you must have the possibility to add a wheight to each backend to moderate the load (like nortel alteon)... no?From: Mladen Turk [mailto:[EMAIL PROTECTED]To: dev@httpd.apache.orgSent: Tue, 20 Jun 2006 09:02:44 +0200Subject: [EMAIL PROTECTED] Re: mod_proxy_balancer/mod_proxy_ajp TODOHenri Gomez wrote: Important point in load balancing will be to collect CPU load (job load) from the remote. We often make the mistake to split requests between servers as if it cost the same CPU power (or cpu load) for each of them, but in Java / J2EE some requests could be more CPU/IO/DB consuming than others.Well, I'm not sure that having the CPU load would mean something.For example you might have P3/1GHz and P66/100GHz with thesame load (close to 80%), and that info in that case would beactually misleading. It might help only if your hardware topologyis exactly the same for all backend servers.The bussines method OTOH will favor the 100GHz box over 1GHz one,thus giving more sense. Even with the same hardware topology,it is presumable that the shorter reply timeout would mean lessCPU cycles used.Regards,Mladen.


Re: [EMAIL PROTECTED] Re: debug apache

2006-06-21 Thread Mathieu CARBONNEAUX




i'm not sure that only apr solution because is httpd information to log... no hook only information...but can be acheve with hook of hook... and this idea can be posted to [EMAIL PROTECTED]but can be apache hook impl super macro to acheve this...and the information to log rely on apache log mecanic...and must be activable/desactivable like extended status...Regards,MAthieuFrom: Alexander Lazic [mailto:[EMAIL PROTECTED]To: dev@httpd.apache.orgSent: Wed, 21 Jun 2006 09:42:59 +0200Subject: [EMAIL PROTECTED] Re: debug apacheOn Die 20.06.2006 18:40, William A. Rowe, Jr. wrote:Jeff Trawick wrote:A past discussion of very closely related functionality, though notexactly what you asked for originally, yielded multiple interestedadmin-type folks and no developers expressing interest other thanmyself.And also Jeff's already suggested you bring the subject up at [EMAIL PROTECTED].Since Apache httpd is not the only program using apr, you might find-more- developers interested in working on this feature since it wouldhelp their program as well.Hm well, i will overthink this, i'am not very glad for this, but isounds the logical correct way.regardsAlex


Re: [EMAIL PROTECTED] Re: debug apache

2006-06-18 Thread Mathieu CARBONNEAUX




i think is very usefull to have this in production environment... to debug probleme without interupting production... in only up the log level with reload...with strace you must restart apache with strace...and for desactivating it you must restart... in some production environement is not acceptable...From: Nick Kew [mailto:[EMAIL PROTECTED]To: dev@httpd.apache.orgSent: Sat, 17 Jun 2006 14:14:25 +0200Subject: [EMAIL PROTECTED] Re: debug apacheOn Saturday 17 June 2006 09:47, Ruediger Pluem wrote: On 06/17/2006 08:57 AM, Alexander Lazic wrote:  On Sam 17.06.2006 00:54, Ruediger Pluem wrote:  From my current point of view the answer is: No, this is not possible  out of the box.  It may be possible if you modify the hook macros.   And do you think that the developer would accept a patch for apache 2.x  and would apply it? Depends on the patch :-). Please take into account that these macros are part of apr-util. So this discussion belongs to dev@apr.apache.org. Currently I have not made any thoughts how these macros could be modified in a way such that they play together with httpd logging.I think you'd be far better off with a generic trace such as strace.They're made for precisely this kind of thing.Having said that. what you could do with the hooks is to wrap themin functions that add logging.  To do that with apache logging wouldrequire the APR macros to be masked out.  Since you'd be adding overhead to everything the server does, you'll never get it acceptedinto the main source tree, unless you can at the very least make itconditionally compile.-- Nick Kew


Re: [EMAIL PROTECTED] Re: debug apache

2006-06-18 Thread Mathieu CARBONNEAUX




ok i've forget that possibility :)but using strace directly by attaching to processus can be risky in production (like gdb!)... and with apache with 256 or 512 processuss all working can be hard to debug...in some time have lost the processus...by attempting to attach to it...and yes is very low level trace... in first aproche debug log can usefull to see where the problem are and after can be useful to use strace/ltrace to deep into the problem...debug trace can be usefull to encircle the problem...and to have trace of internal information of apache is not very freindly in using strace/ltrace... than debug log that are trace important information...i think is more simple to make corelation with debug trace...and with proprietary module like websphere and weblogic can be deficulte to make good filter in strace/ltrace to debug...and some is only to debug configuration probleme... not only bug...Regards,MathieuFrom: Ruediger Pluem [mailto:[EMAIL PROTECTED]To: dev@httpd.apache.orgSent: Sun, 18 Jun 2006 15:03:59 +0200Subject: Re: [EMAIL PROTECTED] Re: debug apacheOn 06/18/2006 02:49 PM, Mathieu CARBONNEAUX wrote: i think is very usefull to have this in production environment... to debug probleme without interupting production... in only up the log level with reload... with strace you must restart apache with strace...and for desactivating it you must restart... in some production environement is not acceptable...Why that? You can attach strace to running processes, provided that you have appropriate permissions on this process. Soyou might need root access for this.Of course I admit that the strace / ltrace output is generic and a more specific output by logging inside the hookscould provide better information.RegardsRüdiger


Re: [EMAIL PROTECTED] Re: Compiling a C++ module with g++ on Solaris

2006-06-15 Thread Mathieu CARBONNEAUX




what is the version of libstdc++ on solaris and on linux?and version of gcc ?From: Jean-frederic Clere [mailto:[EMAIL PROTECTED]To: dev@httpd.apache.orgSent: Mon, 12 Jun 2006 22:14:29 +0200Subject: [EMAIL PROTECTED] Re: Compiling a C++ module with g++ on SolarisPhil Endecott wrote: Dear All, I'm the author of Anyterm (http://anyterm.org/) which uses an Apache  module written in C++.  This works OK on Linux.  However, a user has  attempted to compile it on Solaris and it fails at run time.  Specifically, the first time that any C++ memory allocation stuff  happens - it creates a std::string in the post_config hook function -  it segfaults deep inside libstdc++.Have you try with sun studio? This user is using g++ 3.4.3 and the Sun linker on Solaris 10 x86.   I'm curous to know if any readers have any experience compiling C++  Apache modules on this platform, and whether there are any gotchas to  look out for. Is it possible that there is some libstdc++ initialisation that hasn't  happened?  I could imagine that this would require special support  from the linker or the dlopen stuff, and that that behaves differently  with Sun's libc and linker than on Linux. Any ideas?  He has tried with 2.0.5? and 2.2.? with the same result. Cheers, Phil.


Re: [EMAIL PROTECTED] Re: Compiling a C++ module with g++ on Solaris

2006-06-15 Thread Mathieu CARBONNEAUX




yes try sun studio, v10 and v11 are free for use... than can been download for free on sun site...and work on solaris 8,9 and 10...From: Jean-frederic Clere [mailto:[EMAIL PROTECTED]To: dev@httpd.apache.orgSent: Mon, 12 Jun 2006 22:14:29 +0200Subject: [EMAIL PROTECTED] Re: Compiling a C++ module with g++ on SolarisPhil Endecott wrote: Dear All, I'm the author of Anyterm (http://anyterm.org/) which uses an Apache  module written in C++.  This works OK on Linux.  However, a user has  attempted to compile it on Solaris and it fails at run time.  Specifically, the first time that any C++ memory allocation stuff  happens - it creates a std::string in the post_config hook function -  it segfaults deep inside libstdc++.Have you try with sun studio? This user is using g++ 3.4.3 and the Sun linker on Solaris 10 x86.   I'm curous to know if any readers have any experience compiling C++  Apache modules on this platform, and whether there are any gotchas to  look out for. Is it possible that there is some libstdc++ initialisation that hasn't  happened?  I could imagine that this would require special support  from the linker or the dlopen stuff, and that that behaves differently  with Sun's libc and linker than on Linux. Any ideas?  He has tried with 2.0.5? and 2.2.? with the same result. Cheers, Phil.


Re: [EMAIL PROTECTED] debug apache

2006-06-01 Thread Mathieu CARBONNEAUX




it's a very good idea to add this!From: Alexander Lazic [mailto:[EMAIL PROTECTED]To: dev@httpd.apache.orgSent: Thu, 01 Jun 2006 08:14:11 +0200Subject: [EMAIL PROTECTED] debug apacheHi,i have read http://httpd.apache.org/dev/debugging.html and asked mefollwing:Is it possible to get a logentry from the hooks in apache to see theflow of a request?eg:$REQUEST accepted on $FD$REQUEST handled by $MOD_xxx$REQUEST handled by $MOD_xxx$REQUEST handled by $MOD_xxx$REQUEST handled by $MOD_xxx$REQUEST send to clientor$REQUEST accepted on $FD$REQUEST handled by $MOD_xxx$REQUEST handled by $MOD_PROXY_xxx$REQUEST send on $FD to $PROXY$REQUEST handled by $MOD_xxx$REQUEST handled by $MOD_xxx$REQUEST send to clientI hope i have asked clean enough so that anybody can answer my question;-)regardsAlex


about mod_proxy_fcgi....

2006-05-28 Thread Mathieu CARBONNEAUX
Hi,

Have developed for apache v2.0 a mod_proxy_fcgi 
(http://mproxyfcgi.sourceforge.net) like mod_proxy_ajp of Apache 2.2…
And later have seen some have developed the same thing in 2.3 dev tree…

My need is real fastcgi proxy (mod_fastcgi make very bad job in this way!) on 
apache 2.0…

Ok, but if it possible to work together on the different problem I've seen and 
on what I'm working to correct…

- 1 -
All fastcgi server implementation hare based on fastcgi spec…
And are based on mod_fastcgi logic, and mod_fastcgi send only script to fastcgi 
server to execute…
No gif, jpeg or other files
And for example php fastcgi send systematically text/html for all file…

For that have try to use mime_magic without success, I'm not sure but I think 
mime magic not work with proxy module (hook after proxy ?!!)...
I've not investigated too I source to see why mime magic don’t whant to correct 
mime type... I'm not sure if actually can do that...

Trying to correct mime type on apache proxy is only a temporally solution, the 
ideal solution is to modify server fastcgi implementation to set correctly the 
mime type on each file it serv...

And after I'm not sure all fastcgi implementation of scripting language can 
correctly manage other file than script without problem...
Php seem to accept correctly that type of file... but he tries to interpret all 
file not just php file... is not the good way...
I think is necessary to modify fastcgi implementation to manage a filter to 
send directly file if not have the good extension...
To prevent bad interpretation of file that is in binary format...and over cpu 
on fastcgi server to try to interpret script on any binary file...

- 2 -
In mod_fastcgi the index searching are managed by apache… not by the fastcgi 
server…
If you try to go to http://myserverhttp/myappfcgi/ (with PassReverse /myappfcgi 
fcgi://myfcgiserver:1)
You receive no imput file error from php... because is a directory...
And php not manage the fact if index.php (or other index) exists...

Is a possibility to mod_proxy_fcgi to try any index, 404 errors on file 
terminated by /... but is time consuming to send each time a request to check 
if index.xxx exists...
But is a temporary solution, and also on this problem the good way is to modify 
fastcgi server to implement index searching option...

Have maked a patch for php to do that (hard coded...no option to set index file 
list... for the moment...), and it work fine!
I will post on sourceforge in the next week...

- 3 -
fastcgi implementation define the possibility (define actually this var : 
FCGI_MAX_CONNS,FCGI_MAX_REQS,FCGI_MPXS_CONNS) to get parameter value from 
fastcgi server with FCGI_GET_VALUES management record...
To generate PATHTRANSLATED correctly to the target fastcgi server tree...

My idea is to add new VALUE to get (at proxy first connection to that 
server...!?) from fastcgi server is the DOCUMENT_ROOT to base the 
PATHTRANSLATED generation on automatically it...

In other way, I'm adding the possibility to force target DocumentRoot in apache 
proxy module by configuration option...

- 4 -
The fastcgi specification make possible to manage keepalive (and the 
possibility to mux different request in one connexion!)...
But any implementation has seen of this protocol don’t use it: mod_fastcgi, 
lighttpd, mod_fcgid, the 2.3 mod_proxy_fcgi, all close connection after each 
request...

It is to be regretted that not possible to do that...

Have tried to do keepalive with php, and some time have fastcgi record of other 
request (have used real different id on each request from apache request id)...

I go to try to send systematically FCGI_ABORT_REQUEST management record if 
apache abort request and wait for FCGI_END_REQUEST ... 
But I'm not sure that will work...

The ideal is to have packet system (fastcgi use record like packet...) attach 
to a pool of connexion...
Based on bucket implementation (that only handle FastCGI header...)??! Each 
bucket = fastcgi record (have seen some thing like that in mod_fcgid?...)!!!?? 
How to do that??!!
Packet systems that send only record based on request id to the good proxy 
handle have begun the fastcgi request...


- 5 -
Fastcgi implementations specify the possibility (FCGI_KEEP_CONN on 
FCGI_BeginRequestBody struct field flags) on FCGI_BEGIN_REQUEST record to 
specify the socket close mode...
Actually all implementation I've seen force close from FastCGI client (apache 
side)...

I'm not sure is a good thing to close on apache side... (Generate many TIME 
WAIT on FastCGI server side...)

Have tried to use FastCGI server close side...
But not receive the end of the request (on php implementation, have not tested 
other one...)...
But I've not found why php don’t send the end of the request...


The 1 and 2 are major problem, 3 are moderated problem, and 4 and 5 are minor...

I'm very interested on you idea on this problem...

Best regards,
Mathieu