You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Kaushal Jha <kj...@zedo.com> on 2006/01/19 18:08:49 UTC

apache 2.0 module code clean-up

hey guys,
          I have this module which runs from within apache2.0 and at times it
results in segmentation faults.

how should I approach cleaning up this code (which spans multiple files) of
all the null pointer issues. is there some tool that could show me where the
problem  is at ?

I am aware of mod_log_forensic but i cant use it since on the production
server i need to use the live logs and cant play around with them.


Thanks in advance.

Re: apache 2.0 module code clean-up

Posted by Kaushal Jha <kj...@zedo.com>.
apologies.


and thanks for taking the time to direct me to the correct list. :)

--


---------- Original Message -----------
From: Sander Temme <sc...@apache.org>
To: dev@httpd.apache.org
Sent: Thu, 19 Jan 2006 09:38:15 -0800
Subject: Re: apache 2.0 module code clean-up

> Hi Kaushal,
> 
> Stuff like this is probably better discussed on the apache-modules  
> list. You can subscribe to that at:
> 
> http://modules.apache.org/subscribe
> 
> On Jan 19, 2006, at 9:08 AM, Kaushal Jha wrote:
> 
> > how should I approach cleaning up this code (which spans multiple  
> > files) of
> > all the null pointer issues. is there some tool that could show me  
> > where the
> > problem  is at ?
> 
> The best tool to use is probably gdb in combination with core dumps.
> 
> How to make Apache dump core on segmentation faults is different for 
>  every opereating system. It looks like the information on http:// 
> httpd.apache.org/dev/debugging.html is somewhat specific to Solaris, 
>  we should probably include some tips about Linux and other 
> operating  systems as well.
> 
> On Linux:
> 
> 1) Make sure to run ulimit -c unlimited from the shell that
>     is going to start Apache. You can hack this into the
>     apachectl script or the rc?.d startup script for your
>     server.
> 2) Add the directive:
> 
>     CoredumpDirectory /somewhere
> 
>     to your httpd.conf. The location (/somewhere) needs
>     to be a directory that the httpd child processes
>     can write to, so it must be writable by the user
>     name specified in the User directive (or by everyone,
>     but that's up to you). The disk partition that holds
>     this directory must also have enough space to store
>     all the core images you expect to receive.
> 
> You can analyze the core images by running
> 
> $ gdb /path/to/httpd -core /somewhere/yourcore
> 
> I can't go into details on how to use gdb (the bt command should  
> cover most of your needs), but there is ample literature about that.
> 
> To use gdb, it's probably a good idea to compile Apache with  
> debugging symbols. You can do this by specifying
> 
> $ CFLAGS="-DDEBUG -g -O0" ./configure ...
> 
> when you start the build process.
> 
> Good luck!
> 
> S.
> 
> -- 
> sander@temme.net              http://www.temme.net/sander/
> PGP FP: 51B4 8727 466A 0BC3 69F4  B7B8 B2BE BC40 1529 24AF
------- End of Original Message -------


Re: apache 2.0 module code clean-up

Posted by Kaushal Jha <kj...@zedo.com>.
apologies.


and thanks for the correct direction. :)

--


---------- Original Message -----------
From: Sander Temme <sc...@apache.org>
To: dev@httpd.apache.org
Sent: Thu, 19 Jan 2006 09:38:15 -0800
Subject: Re: apache 2.0 module code clean-up

> Hi Kaushal,
> 
> Stuff like this is probably better discussed on the apache-modules  
> list. You can subscribe to that at:
> 
> http://modules.apache.org/subscribe
> 
> On Jan 19, 2006, at 9:08 AM, Kaushal Jha wrote:
> 
> > how should I approach cleaning up this code (which spans multiple  
> > files) of
> > all the null pointer issues. is there some tool that could show me  
> > where the
> > problem  is at ?
> 
> The best tool to use is probably gdb in combination with core dumps.
> 
> How to make Apache dump core on segmentation faults is different for 
>  every opereating system. It looks like the information on http:// 
> httpd.apache.org/dev/debugging.html is somewhat specific to Solaris, 
>  we should probably include some tips about Linux and other 
> operating  systems as well.
> 
> On Linux:
> 
> 1) Make sure to run ulimit -c unlimited from the shell that
>     is going to start Apache. You can hack this into the
>     apachectl script or the rc?.d startup script for your
>     server.
> 2) Add the directive:
> 
>     CoredumpDirectory /somewhere
> 
>     to your httpd.conf. The location (/somewhere) needs
>     to be a directory that the httpd child processes
>     can write to, so it must be writable by the user
>     name specified in the User directive (or by everyone,
>     but that's up to you). The disk partition that holds
>     this directory must also have enough space to store
>     all the core images you expect to receive.
> 
> You can analyze the core images by running
> 
> $ gdb /path/to/httpd -core /somewhere/yourcore
> 
> I can't go into details on how to use gdb (the bt command should  
> cover most of your needs), but there is ample literature about that.
> 
> To use gdb, it's probably a good idea to compile Apache with  
> debugging symbols. You can do this by specifying
> 
> $ CFLAGS="-DDEBUG -g -O0" ./configure ...
> 
> when you start the build process.
> 
> Good luck!
> 
> S.
> 
> -- 
> sander@temme.net              http://www.temme.net/sander/
> PGP FP: 51B4 8727 466A 0BC3 69F4  B7B8 B2BE BC40 1529 24AF
------- End of Original Message -------


Re: apache 2.0 module code clean-up

Posted by Sander Temme <sc...@apache.org>.
Hi Kaushal,

Stuff like this is probably better discussed on the apache-modules  
list. You can subscribe to that at:

http://modules.apache.org/subscribe

On Jan 19, 2006, at 9:08 AM, Kaushal Jha wrote:

> how should I approach cleaning up this code (which spans multiple  
> files) of
> all the null pointer issues. is there some tool that could show me  
> where the
> problem  is at ?

The best tool to use is probably gdb in combination with core dumps.

How to make Apache dump core on segmentation faults is different for  
every opereating system. It looks like the information on http:// 
httpd.apache.org/dev/debugging.html is somewhat specific to Solaris,  
we should probably include some tips about Linux and other operating  
systems as well.

On Linux:

1) Make sure to run ulimit -c unlimited from the shell that
    is going to start Apache. You can hack this into the
    apachectl script or the rc?.d startup script for your
    server.
2) Add the directive:

    CoredumpDirectory /somewhere

    to your httpd.conf. The location (/somewhere) needs
    to be a directory that the httpd child processes
    can write to, so it must be writable by the user
    name specified in the User directive (or by everyone,
    but that's up to you). The disk partition that holds
    this directory must also have enough space to store
    all the core images you expect to receive.

You can analyze the core images by running

$ gdb /path/to/httpd -core /somewhere/yourcore

I can't go into details on how to use gdb (the bt command should  
cover most of your needs), but there is ample literature about that.

To use gdb, it's probably a good idea to compile Apache with  
debugging symbols. You can do this by specifying

$ CFLAGS="-DDEBUG -g -O0" ./configure ...

when you start the build process.

Good luck!

S.

-- 
sander@temme.net              http://www.temme.net/sander/
PGP FP: 51B4 8727 466A 0BC3 69F4  B7B8 B2BE BC40 1529 24AF