Subject: Sigpipes in ssl_io_hook_writev

From: Alexander Wirtz <[email-masked]>
Date: Fri, 09 May 2003 21:14:45 +0200

Okay, I hope I'm not repeating myself, 'cause the majordomo apparently
moved my mail to /dev/zero a few days ago...

System is a Linux Debian Woody,
libssl 0.9.6c-2.woody,
libmm 1.1.3-6.1
from Debian archive

Apache 1.3.27,
mod_ssl 2.8.14-1.3.27,
PHP 4.3 CVS
handmade with APACI

CFLAGS=-g \
SSL_BASE=SYSTEM \
EAPI_MM=SYSTEM \
./configure \
--prefix=/usr/local/apache \
--logfiledir=/var/log/apache \
--runtimedir=/var/run \
--enable-rule=SHARED_CORE \
--disable-module=userdir \
--disable-module=status \
--enable-module=so \
--enable-module=ssl \
--enable-module=rewrite \
--enable-module=speling \
--enable-module=vhost_alias \
--enable-shared=ssl \
--enable-shared=rewrite \
--enable-shared=speling \
--enable-shared=vhost_alias \
--permute-module=ssl:END

Exhibit 1:
----------
Program received signal SIGPIPE, Broken pipe.
0x401d7277 in ?? ()
(gdb) bt
#0  0x401d7277 in ?? ()
#1  0x40782bfa in ssl_io_hook_writev () from
/usr/local/apache/libexec/libssl.so
#2  0x40066ce1 in ap_hook_call_func () from /lib/libdb.so.2
#3  0x400663d4 in ap_hook_call () from /lib/libdb.so.2
#4  0x4003c9a8 in writev_it_all () from /lib/libcrypt.so.1
#5  0x4003ce4e in large_write () from /lib/libcrypt.so.1
#6  0x4003cf27 in ap_bwrite () from /lib/libcrypt.so.1
#7  0x40053b52 in ap_rwrite () from /lib/libcrypt.so.1
#8  0x404e3562 in sapi_apache_ub_write (
    str=0x82b26f4 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01
Transitional//EN\">\n<!--\n\tThe documents on this site validate
as\n\t\tHTML 4.01 Transitional\n\tas you can easily check on
http://validator.w3.org/check?uri=http"...,
    str_length=13713) at /mnt/usr/local/src/php4/sapi/apache/mod_php4.c:102
#9  0x404a2f06 in php_ub_body_write_no_header ( str=0x82b26f4 "<!DOCTYPE
HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<!--\n\tThe
documents on this site validate as\n\t\tHTML 4.01 Transitional\n\tas you
can easily check on http://validator.w3.org/check?uri=http"...,
str_length=13713) at /mnt/usr/local/src/php4/main/output.c:668
#10 0x404a2ffb in php_ub_body_write (
    str=0x82b26f4 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01
Transitional//EN\">\n<!--\n\tThe documents on this site validate
as\n\t\tHTML 4.01 Transitional\n\tas you can easily check on
http://validator.w3.org/check?uri=http"...,
    str_length=13713) at /mnt/usr/local/src/php4/main/output.c:698
#11 0x404a2233 in php_end_ob_buffer (send_buffer=1 '\001', just_flush=1
'\001')
    at /mnt/usr/local/src/php4/main/output.c:296
#12 0x404a3f67 in php_ob_append (
    text=0x82c3744 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01
Transitional//EN\">\n<!--\n\tThe documents on this site validate
as\n\t\tHTML 4.01 Transitional\n\tas you can easily check on
http://validator.w3.org/check?uri=http"...,
    text_length=13713) at /mnt/usr/local/src/php4/main/output.c:594
#13 0x404a2ebb in php_b_body_write (
    str=0x82c3744 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01
Transitional//EN\">\n<!--\n\tThe documents on this site validate
as\n\t\tHTML 4.01 Transitional\n\tas you can easily check on
http://validator.w3.org/check?uri=http"...,
    str_length=13713) at /mnt/usr/local/src/php4/main/output.c:654
#14 0x404a2233 in php_end_ob_buffer (send_buffer=1 '\001', just_flush=0
'\0')
    at /mnt/usr/local/src/php4/main/output.c:296
#15 0x404a23bf in php_end_ob_buffers (send_buffer=1 '\001') at
/mnt/usr/local/src/php4/main/output.c:335
#16 0x4048d0b4 in php_request_shutdown (dummy=0x0) at
/mnt/usr/local/src/php4/main/main.c:958
#17 0x404e3498 in apache_php_module_main (r=0x80edf08,
display_source_mode=0)
    at /mnt/usr/local/src/php4/sapi/apache/sapi_apache.c:61
#18 0x404e44d0 in send_php (r=0x80edf08, display_source_mode=0,
    filename=0x80ee470 "/usr/local/apache_vhosts/pc4p/htdocs/index.php")
    at /mnt/usr/local/src/php4/sapi/apache/mod_php4.c:617
#19 0x404e454f in send_parsed_php (r=0x80edf08) at
/mnt/usr/local/src/php4/sapi/apache/mod_php4.c:632
#20 0x4003e4c9 in ap_invoke_handler () from /lib/libcrypt.so.1
#21 0x40057563 in process_request_internal () from /lib/libcrypt.so.1
#22 0x40057a1f in ap_internal_redirect () from /lib/libcrypt.so.1
#23 0x40031a9a in handle_dir () from /lib/libm.so.6
#24 0x4003e4c9 in ap_invoke_handler () from /lib/libcrypt.so.1
#25 0x40057563 in process_request_internal () from /lib/libcrypt.so.1
#26 0x400575dd in ap_process_request () from /lib/libcrypt.so.1
#27 0x4004cb30 in child_main () from /lib/libcrypt.so.1
#28 0x4004cd47 in make_child () from /lib/libcrypt.so.1
#29 0x4004cef7 in startup_children () from /lib/libcrypt.so.1
#30 0x4004d676 in standalone_main () from /lib/libcrypt.so.1
#31 0x4004e0f3 in ap_main () from /lib/libcrypt.so.1
#32 0x080486c3 in ?? ()
#33 0x4012614f in fnmatch () from /lib/libc.so.6

Exhibit 2:
----------
Program received signal SIGPIPE, Broken pipe.
0x401d8277 in ?? ()
(gdb) bt
#0  0x401d8277 in ?? ()
#1  0x40785c1a in ssl_io_hook_writev (fb=0x8055e80, iov=0xbffff974,
iovcnt=1) at ssl_engine_io.c:441
#2  0x40066c21 in ap_hook_call_func (ap=0xbffff8f8, he=0x8054600,
hf=0x807b0c8) at ap_hook.c:649
#3  0x40066314 in ap_hook_call (hook=0x40092762 "ap::buff::writev") at
ap_hook.c:382
#4  0x4003c988 in writev_it_all (fb=0x8055e80, vec=0xbffff96c, nvec=2)
at buff.c:1136
#5  0x4003ce2e in large_write (fb=0x8055e80, buf=0x407b6000,
nbyte=32768) at buff.c:1293
#6  0x4003cf07 in ap_bwrite (fb=0x8055e80, buf=0x407b6000, nbyte=32768)
at buff.c:1356
#7  0x40053774 in ap_send_mmap (mm=0x407b6000, r=0x80ee098, offset=0,
length=408064) at http_protocol.c:2588
#8  0x400474e2 in default_handler (r=0x80ee098) at http_core.c:3976
#9  0x4003e51c in ap_invoke_handler (r=0x80ee098) at http_config.c:530
#10 0x40057513 in process_request_internal (r=0x80ee098) at
http_request.c:1308
#11 0x4005758d in ap_process_request (r=0x80ee098) at http_request.c:1324
#12 0x4004cb03 in child_main (child_num_arg=0) at http_main.c:4689
#13 0x4004cd17 in make_child (s=0x804b950, slot=0, now=1052246740) at
http_main.c:4813
#14 0x4004cec7 in startup_children (number_to_start=10) at http_main.c:4895
#15 0x4004d646 in standalone_main (argc=3, argv=0xbffffd54) at
http_main.c:5203
#16 0x4004e0c3 in ap_main (argc=3, argv=0xbffffd54) at http_main.c:5566
#17 0x080486c3 in ?? ()
#18 0x4012714f in fnmatch () from /lib/libc.so.6

I can pinpoint the page on which exhibit 1 occurred, it has nothing to
do with SSL whatsoever. The apache-children are going into a
"wait-for-sigpipe"-mode after a while, which means, by repeated access
to a page I can kill all children until MinSpareServers is reached. The
fresh children are serving the page ok then.
I was thinking about an error in PHP first, but I couldn't tie the
problem to PHP, so I'm now counting on you guys here.

Btw. the BugDB is broken, down, not accessible...

Best regards,
Alex

______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      [email-masked]
Automated List Manager                            [email-masked]