You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Erik Abele <er...@codefaktor.de> on 2002/12/30 04:10:08 UTC

Segfault in 2.1 head on linux

After building the current Apache 2.1 & APR HEAD I hit a segfault by starting the server. A quick gdb session shows problems in apr_file_open at apr/file_io/unix/open.c:149

-----------------------------------------------------------------------
(gdb) run -X
Starting program: /usr/sbin/httpd -X
[New Thread 1024 (LWP 21251)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 21251)]
0x401ef78d in apr_file_open (new=0xbffff59c, 
    fname=0x8147078 "/etc/httpd/conf/httpd.conf", flag=129, perm=4095, 
    pool=0x80ff8d0) at open.c:149
149	    if ((flag & APR_BUFFERED) && ((*new)->flags & APR_XTHREAD)) {
(gdb) bt
#0  0x401ef78d in apr_file_open (new=0xbffff59c, 
    fname=0x8147078 "/etc/httpd/conf/httpd.conf", flag=129, perm=4095, 
    pool=0x80ff8d0) at open.c:149
#1  0x080b71d8 in ap_pcfg_openfile (ret_cfg=0xbffff638, p=0x80ff8d0, 
    name=0x8147078 "/etc/httpd/conf/httpd.conf") at util.c:910
#2  0x080b2e52 in ap_process_resource_config (s=0x8106320, 
    fname=0x8147078 "/etc/httpd/conf/httpd.conf", conftree=0x80f2354, 
    p=0x80ff8d0, ptemp=0x81439e0) at config.c:1545
#3  0x080b352f in ap_read_config (process=0x80fd948, ptemp=0x81439e0, 
    filename=0x80e2abb "/etc/httpd/conf/httpd.conf", conftree=0x80f2354)
    at config.c:1832
#4  0x080b5130 in main (argc=2, argv=0xbffff8e4) at main.c:565
#5  0x42017589 in __libc_start_main () from /lib/i686/libc.so.6
(gdb) print (*new)->flags
Cannot access memory at address 0xc
(gdb) print (*new)       
$2 = (apr_file_t *) 0x0
-----------------------------------------------------------------------

seems that this has something to do with the latest changes in apr/file_io/unix/open.c... the following patch works fine for me.

--- /home/cvs/apr/file_io/unix/open.c	Mon Dec 30 02:58:01 2002
+++ open.c	Mon Dec 30 03:59:26 2002
@@ -146,7 +146,7 @@
 #endif
     
 #if APR_HAS_THREADS
-    if ((flag & APR_BUFFERED) && ((*new)->flags & APR_XTHREAD)) {
+    if ((flag & APR_BUFFERED) && (flag & APR_XTHREAD)) {
         rv = apr_thread_mutex_create(&thlock,
                                      APR_THREAD_MUTEX_DEFAULT, pool);
         if (rv) {

also does reverting open.c to rev. 1.101.

cheers,
erik


Re: Segfault in 2.1 head on linux

Posted by Brian Pane <br...@cnet.com>.
On Sun, 2002-12-29 at 19:10, Erik Abele wrote:

> seems that this has something to do with the latest changes in apr/file_io/unix/open.c... the following patch works fine for me.
> 
> --- /home/cvs/apr/file_io/unix/open.c	Mon Dec 30 02:58:01 2002
> +++ open.c	Mon Dec 30 03:59:26 2002
> @@ -146,7 +146,7 @@
>  #endif
>      
>  #if APR_HAS_THREADS
> -    if ((flag & APR_BUFFERED) && ((*new)->flags & APR_XTHREAD)) {
> +    if ((flag & APR_BUFFERED) && (flag & APR_XTHREAD)) {

Thanks, I just committed the fix.

Brian



Re: Segfault in 2.1 head on linux

Posted by Brian Pane <br...@cnet.com>.
On Sun, 2002-12-29 at 19:10, Erik Abele wrote:

> seems that this has something to do with the latest changes in apr/file_io/unix/open.c... the following patch works fine for me.
> 
> --- /home/cvs/apr/file_io/unix/open.c	Mon Dec 30 02:58:01 2002
> +++ open.c	Mon Dec 30 03:59:26 2002
> @@ -146,7 +146,7 @@
>  #endif
>      
>  #if APR_HAS_THREADS
> -    if ((flag & APR_BUFFERED) && ((*new)->flags & APR_XTHREAD)) {
> +    if ((flag & APR_BUFFERED) && (flag & APR_XTHREAD)) {

Thanks, I just committed the fix.

Brian