Connection time out problems

"Brian J. France" <[email protected]>
Newsgroups gmane.comp.apache.mod-ssl.user
Message-ID <[email protected]>
I have a case where a https connection times out, which causes an alarm 
to trigger, apache start shutting down and mod_ssl tries to flush the 
buffer in a non-blocking way and hangs the connection until restart 
(see the backtrace below).

I think the cause of this is the http_main.c patch for EAPI (see below) 
because it inserts the ap_call_close_connection_hook before setting 
B_EOUT instead of after.  If it would set B_OUT first and then call 
ap_call_close_connection_hook, any ap_bflush or ap_bwrite calls would 
return (-1) instead of trying to write data to the socket (in a 
non-blocking way).

Thoughts?

Thanks,

Brian

--------
@@ -1541,6 +1568,10 @@
             ap_log_transaction(log_req);
         }

+#ifdef EAPI
+       ap_call_close_connection_hook(save_req->connection);
+#endif /* EAPI */
+
         ap_bsetflag(save_req->connection->client, B_EOUT, 1);
         ap_bclose(save_req->connection->client);

@@ -1549,6 +1580,9 @@
          ap_longjmp(jmpbuffer, 1);
      }
      else {                     /* abort the connection */
+#ifdef EAPI
+       ap_call_close_connection_hook(current_conn);
+#endif /* EAPI */
         ap_bsetflag(current_conn->client, B_EOUT, 1);
         ap_bclose(current_conn->client);
         current_conn->aborted = 1;
--------

#0  0x20307a20 in write () from /usr/lib/libc.so.4
#1  0x20220456 in sock_write () from /home/y/lib/libcrypto.so
#2  0x2021e5cf in BIO_write () from /home/y/lib/libcrypto.so
#3  0x201bc503 in ssl3_write_pending () from /home/y/lib/libssl.so
#4  0x201bc26a in do_ssl3_write () from /home/y/lib/libssl.so
#5  0x201bc1e2 in ssl3_write_bytes () from /home/y/lib/libssl.so
#6  0x201ba665 in ssl3_write () from /home/y/lib/libssl.so
#7  0x201c1b92 in SSL_write () from /home/y/lib/libssl.so
#8  0x3b7d6 in ssl_io_hook_write (fb=0x267044, buf=0x2e900c 
"<removed>"..., len=4096) at ssl_engine_io.c:384
#9  0x67741 in ap_hook_call_func (ap=0x9fbfb404 "4´¿\237Dp&", 
he=0xa5080, hf=0xa7110) at ap_hook.c:649
#10 0x673f6 in ap_hook_call (hook=0x7c0e4 "ap::buff::write") at 
ap_hook.c:382
#11 0x48b1e in ap_write (fb=0x267044, buf=0x2e900c, nbyte=4096) at 
buff.c:336
#12 0x49676 in write_with_errors (fb=0x267044, buf=0x2e900c, 
nbyte=4096) at buff.c:391
#13 0x49f72 in bflush_core (fb=0x267044) at buff.c:1760
#14 0x49ffa in ap_bflush (fb=0x267044) at buff.c:1805
#15 0x393f3 in ssl_hook_CloseConnection (conn=0xc8068) at 
ssl_engine_kernel.c:474
#16 0x525f6 in ap_call_close_connection_hook (c=0xc8068) at 
http_main.c:523
#17 0x52ea7 in timeout (sig=14) at http_main.c:1738
#18 0x52fcc in alrm_handler (sig=14) at http_main.c:1812
#19 0x9fbfffac in ?? ()
#20 0x2021e5cf in BIO_write () from /home/y/lib/libcrypto.so
#21 0x201bc503 in ssl3_write_pending () from /home/y/lib/libssl.so
#22 0x201bc440 in do_ssl3_write () from /home/y/lib/libssl.so
#23 0x201bc1e2 in ssl3_write_bytes () from /home/y/lib/libssl.so
#24 0x201ba665 in ssl3_write () from /home/y/lib/libssl.so
#25 0x201c1b92 in SSL_write () from /home/y/lib/libssl.so
#26 0x3b7d6 in ssl_io_hook_write (fb=0x267044, buf=0x2e900c 
"<removed>"..., len=4096) at ssl_engine_io.c:384
#27 0x67741 in ap_hook_call_func (ap=0x9fbfb930 "`¹¿\237Dp&", 
he=0xa5080, hf=0xa7110) at ap_hook.c:649
#28 0x673f6 in ap_hook_call (hook=0x7c0e4 "ap::buff::write") at 
ap_hook.c:382
#29 0x48b1e in ap_write (fb=0x267044, buf=0x2e900c, nbyte=4096) at 
buff.c:336
#30 0x49676 in write_with_errors (fb=0x267044, buf=0x2e900c, 
nbyte=4096) at buff.c:391
#31 0x49f72 in bflush_core (fb=0x267044) at buff.c:1760
#32 0x49ffa in ap_bflush (fb=0x267044) at buff.c:1805

< internal code frames removed >

#38 0x4ac04 in ap_invoke_handler (r=0x1ef034) at http_config.c:479
#39 0x5d0ac in process_request_internal (r=0x1ef034) at 
http_request.c:1366
#40 0x5d107 in ap_process_request (r=0x1ef034) at http_request.c:1382
#41 0x556ba in child_main (child_num_arg=87) at http_main.c:5388
#42 0x559ad in make_child (s=0x9c2e8, slot=87, now=1118326412) at 
http_main.c:5629
#43 0x55c38 in perform_idle_server_maintenance () at http_main.c:5853
#44 0x5617a in standalone_main (argc=11, argv=0x9fbff028) at 
http_main.c:6165
#45 0x5671c in main (argc=11, argv=0x9fbff028) at http_main.c:6448

______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      [email protected]
Automated List Manager                            [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.