Project

General

Profile

Actions

Bug #922

closed

mod_proxy_core hangs when processing large responses from backend.

Added by jakabosky over 17 years ago. Updated over 17 years ago.

Status:
Fixed
Priority:
High
Category:
mod_proxy
Target version:
-
ASK QUESTIONS IN Forums:

Description

I am attaching a patch for lighttpd trunk revision 1464.

mod_proxy_core gets stuck in an infinite loop when it reads only part of a large response from the backend. test by transfering a large(20k) static file over a http proxy setup.


Files

send-tempfile.php (642 Bytes) send-tempfile.php php script to test X-LIGHTTPD-send-tempfile feature. jakabosky, 2006-12-07 02:41
lighttpd-1.5.0-r1464.diff.gz (33.3 KB) lighttpd-1.5.0-r1464.diff.gz Full patch. Includes all my bugs fixes/features for trunk revision 1464 jakabosky, 2006-12-09 06:35
lighttpd-1.5.0-mod_proxy_core-hang.diff.gz (1 Byte) lighttpd-1.5.0-mod_proxy_core-hang.diff.gz remove, use patch for svn revision 1464 jakabosky, 2006-12-09 06:38
lighttpd.conf (4.66 KB) lighttpd.conf example configfile for new mod_proxy_core and X-LIGHTTPD-send-tempfile jakabosky, 2006-12-10 02:20
Actions #1

Updated by jakabosky over 17 years ago

patch lighttpd-1.5.0-r1464.diff.gz
  • mod_proxy_backend_http/fastcgi are now loadable modules. Need to add them to server.modules.
  • Added support for new X-LIGHTTPD-send-tempfile header to mod_procy_core see faster-fastcgi
  • Rewrote http-chunk decoding to fix a bug.
  • Fixed bug with stderr in fastcgi backend. If a php script had a syntax error, it could cause lighttpd to loop infinitely and not response to any other requests.
To use this patch:
  1. svn checkout svn://svn.lighttpd.net/lighttpd/trunk lighttpd-svn
  2. cd lighttpd-svn
  3. gunzip -c ../lighttpd-1.5.0-r1464.diff.gz | patch -p0
  4. sh autogen.sh
  5. ./configure <Your settings here>
  6. make
  7. make install
Actions #2

Updated by Anonymous over 17 years ago

X-LIGHTTPD-send-tempfile not work
X-LIGHTTPD-send-file also not work

2006-12-02 23:02:57: (connections.c.1051) state at start 12 req-start
2006-12-02 23:02:57: (connections.c.1076) state for fd 12 req-start
connections.c.1123: (trace) state for fd=12: read-header
2006-12-02 23:02:57: (connections.c.1175) state for fd 12 handle-req
2006-12-02 23:02:57: (response.c.149) run condition
2006-12-02 23:02:57: (response.c.195) -- splitting Request-URI
2006-12-02 23:02:57: (response.c.196) Request-URI : /st.php
2006-12-02 23:02:57: (response.c.197) URI-scheme : http
2006-12-02 23:02:57: (response.c.198) URI-authority: test.com
2006-12-02 23:02:57: (response.c.199) URI-path : /st.php
2006-12-02 23:02:57: (response.c.200) URI-query :
2006-12-02 23:02:57: (response.c.250) -- sanatising URI
2006-12-02 23:02:57: (response.c.251) URI-path : /st.php
2006-12-02 23:02:57: (configfile-glue.c.430) === start of 1 condition block ===
2006-12-02 23:02:57: (configfile-glue.c.382) HTTPurl ( /st.php ) compare to \.php$
2006-12-02 23:02:57: (configfile-glue.c.445) 1 result: true
2006-12-02 23:02:57: (configfile-glue.c.451) 1 (cached) result: true
2006-12-02 23:02:57: (configfile-glue.c.451) 1 (cached) result: true
2006-12-02 23:02:57: (configfile-glue.c.451) 1 (cached) result: true
2006-12-02 23:02:57: (response.c.367) -- before doc_root
2006-12-02 23:02:57: (response.c.368) Doc-Root : /var/www/test.com/htdocs
2006-12-02 23:02:57: (response.c.369) Rel-Path : /st.php
2006-12-02 23:02:57: (response.c.370) Path :
2006-12-02 23:02:57: (response.c.423) -- after doc_root
2006-12-02 23:02:57: (response.c.424) Doc-Root : /var/www/test.com/htdocs
2006-12-02 23:02:57: (response.c.425) Rel-Path : /st.php
2006-12-02 23:02:57: (response.c.426) Path : /var/www/test.com/htdocs/st.php
2006-12-02 23:02:57: (configfile-glue.c.451) 1 (cached) result: true
mod_proxy_core.c.1392: (error) handling it in mod_proxy_core: uri.path=/st.php
2006-12-02 23:02:57: (configfile-glue.c.451) 1 (cached) result: true
2006-12-02 23:02:57: (response.c.443) -- logical -> physical
2006-12-02 23:02:57: (response.c.444) Doc-Root : /var/www/test.com/htdocs
2006-12-02 23:02:57: (response.c.445) Rel-Path : /st.php
2006-12-02 23:02:57: (response.c.446) Path : /var/www/test.com/htdocs/st.php
2006-12-02 23:02:57: (connections.c.1051) state at start 12 read-content
2006-12-02 23:02:57: (connections.c.1051) state at start 12 read-content
2006-12-02 23:02:57: (response.c.113) Response-Header:
HTTP/1.1 200 OK
Transfer-Encoding: chunked
X-Powered-By: PHP/5.2.0
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-type: text/html;charset=utf-8
Content-Encoding: gzip
Vary: Accept-Encoding
Date: Sat, 02 Dec 2006 21:02:57 GMT
Server: lighttpd/1.5.0

2006-12-02 23:02:57: (connections.c.1400) state for fd 12 resp-end
2006-12-02 23:02:57: (configfile-glue.c.451) 1 (cached) result: true
2006-12-02 23:02:57: (connections.c.1076) state for fd 12 req-start
connections.c.1123: (trace) state for fd=12: read-header
2006-12-02 23:02:57: (connections.c.1051) state at start 12 read-header
connections.c.1123: (trace) state for fd=12: read-header
2006-12-02 23:03:03: (connections.c.1051) state at start 12 error
2006-12-02 23:03:03: (connections.c.1524) shutdown for fd 12
2006-12-02 23:03:03: (connections.c.1435) state for fd 12 close
2006-12-02 23:03:03: (connections.c.1464) connection closed for fd 12
2006-12-02 23:03:03: (connections.c.1064) state for fd 12 connect
2006-12-02 23:03:03: (connections.c.1551) state at exit: 12 connect

-- boom

Actions #3

Updated by jakabosky over 17 years ago

make sure to add this:<br>
proxy-core.allow-x-sendfile = "enable"<br>
<br>
I forgot to add it to my example configfile.<br>
Also do a test without "Content-Encoding: gzip".

Actions #4

Updated by jakabosky over 17 years ago

I fixed a bug in my patch that causes lighttpd to crash when using proxy-core.rewrite-request
to change the request uri.

Actions #5

Updated by Anonymous over 17 years ago

same error in new patch

2006-12-03 15:50:15: (configfile-glue.c.451) 1 (cached) result: true
mod_proxy_core.c.1425: (error) handling it in mod_proxy_core: uri.path=/st.php

-- boom

Actions #6

Updated by Anonymous over 17 years ago

1)
X-LIGHTTPD-send-tempfile not work with linux-aio


network_linux_aio.c.73: (error) opening '/dev/shm/php-tmpfile-9Sh1Zt' failed: Invalid argument
connections.c.1378: (trace) (network-subsys sent us a fatal-error)
2006-12-03 16:36:54: (configfile-glue.c.451) 1 (cached) result: true
2006-12-03 16:36:55: (connections.c.1524) shutdown for fd 12
2006-12-03 16:36:55: (connections.c.1435) state for fd 12 close
2006-12-03 16:36:55: (connections.c.1464) connection closed for fd 12
2006-12-03 16:36:55: (connections.c.1064) state for fd 12 connect
2006-12-03 16:36:55: (connections.c.1551) state at exit: 12 connect
2006-12-03 16:36:55: (connections.c.1051) state at start 12 connect
2006-12-03 16:36:55: (connections.c.1064) state for fd 12 connect
2006-12-03 16:36:55: (connections.c.1551) state at exit: 12 connect
2006-12-03 16:36:59: (server.c.913) [note] graceful shutdown started
log.c.86: (trace) server stopped

==15777== Memcheck, a memory error detector for x86-linux.
==15777== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==15777== Using valgrind-2.4.0, a program supervision framework for x86-linux.
==15777== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==15777== For more details, rerun with: -v
==15777==
==15777== Conditional jump or move depends on uninitialised value(s)
==15777==    at 0x1B9E4D70: strstr (in /lib/libc-2.4.so)
==15777==    by 0x1B969AB8: __pthread_initialize_minimal (in /lib/libpthread-2.4.so)
==15777==    by 0x1B9695B7: ??? (crti.S:18)
==15777==    by 0x1B969167: ??? (crti.S:30)
==15777==    by 0x1B8F1884: call_init (in /lib/ld-2.4.so)
==15777==    by 0x1B8F19AD: _dl_init (in /lib/ld-2.4.so)
==15777==    by 0x1B8E48FE: (within /lib/ld-2.4.so)
==15777==
==15777== Conditional jump or move depends on uninitialised value(s)
==15777==    at 0x1B9E4D74: strstr (in /lib/libc-2.4.so)
==15777==    by 0x1B969AB8: __pthread_initialize_minimal (in /lib/libpthread-2.4.so)
==15777==    by 0x1B9695B7: ??? (crti.S:18)
==15777==    by 0x1B969167: ??? (crti.S:30)
==15777==    by 0x1B8F1884: call_init (in /lib/ld-2.4.so)
==15777==    by 0x1B8F19AD: _dl_init (in /lib/ld-2.4.so)
==15777==    by 0x1B8E48FE: (within /lib/ld-2.4.so)
mod_proxy_core_address.c.158: (trace) resolving 127.0.0.1 on port 1026
mod_proxy_core_address.c.63: (trace) adding 127.0.0.1:1026 to the address-pool
==15777==
==15777== Invalid read of size 4
==15777==    at 0x1B923021: proxy_connection_free (mod_proxy_core_pool.c:22)
==15777==    by 0x1B92308D: proxy_connection_pool_free (mod_proxy_core_pool.c:50)
==15777==    by 0x1B923293: proxy_backend_free (mod_proxy_core_backend.c:22)
==15777==    by 0x1B9232DD: proxy_backends_free (mod_proxy_core_backend.c:36)
==15777==    by 0x1B9206C0: mod_proxy_core_free (mod_proxy_core.c:109)
==15777==    by 0x805F952: plugins_call_cleanup (plugin.c:342)
==15777==    by 0x805F9F2: plugins_free (plugin.c:480)
==15777==    by 0x804FB7A: main (server.c:1694)
==15777==  Address 0x1BADA070 is 128 bytes inside a block of size 136 free'd
==15777==    at 0x1B909989: free (vg_replace_malloc.c:152)
==15777==    by 0x1B9233A0: proxy_address_free (mod_proxy_core_address.c:24)
==15777==    by 0x1B9234FD: proxy_address_pool_free (mod_proxy_core_address.c:39)
==15777==    by 0x1B923288: proxy_backend_free (mod_proxy_core_backend.c:21)
==15777==    by 0x1B9232DD: proxy_backends_free (mod_proxy_core_backend.c:36)
==15777==    by 0x1B9206C0: mod_proxy_core_free (mod_proxy_core.c:109)
==15777==    by 0x805F952: plugins_call_cleanup (plugin.c:342)
==15777==    by 0x805F9F2: plugins_free (plugin.c:480)
==15777==    by 0x804FB7A: main (server.c:1694)
==15777==
==15777== ERROR SUMMARY: 4 errors from 3 contexts (suppressed: 49 from 1)
==15777== malloc/free: in use at exit: 452 bytes in 10 blocks.
==15777== malloc/free: 7472 allocs, 7462 frees, 419425 bytes allocated.
==15777== For counts of detected errors, rerun with: -v
==15777== searching for pointers to 10 not-freed blocks.
==15777== checked 8478876 bytes.
==15777==
==15777== LEAK SUMMARY:
==15777==    definitely lost: 296 bytes in 8 blocks.
==15777==      possibly lost: 136 bytes in 1 blocks.
==15777==    still reachable: 20 bytes in 1 blocks.
==15777==         suppressed: 0 bytes in 0 blocks.

2)
segmentation fault

use this code to test
-------------


<?php

$tempfile = tempnam('/dev/shm/', 'php-tmpfile-');
header("Content-Type: text/html");
header("X-LIGHTTPD-send-tempfile: ".$tempfile);

register_shutdown_function ( "show_profiling");

function show_profiling() {
global $tempfile;
        echo "test";
        $handle = fopen($tempfile, 'w');
        chmod($tempfile, 0644);
        fwrite($handle, ob_get_contents());
        fclose($handle);
        ob_end_clean();
}
?>


log.c.139: (trace) server started
2006-12-03 16:27:17: (connections.c.1051) state at start 12 req-start 
2006-12-03 16:27:17: (connections.c.1076) state for fd 12 req-start 
connections.c.1123: (trace) state for fd=12: read-header
2006-12-03 16:27:17: (connections.c.1175) state for fd 12 handle-req 
2006-12-03 16:27:17: (response.c.149) run condition 
2006-12-03 16:27:17: (response.c.195) -- splitting Request-URI 
2006-12-03 16:27:17: (response.c.196) Request-URI  :  / 
2006-12-03 16:27:17: (response.c.197) URI-scheme   :  http 
2006-12-03 16:27:17: (response.c.198) URI-authority:  test.com
2006-12-03 16:27:17: (response.c.199) URI-path     :  / 
2006-12-03 16:27:17: (response.c.200) URI-query    :   
2006-12-03 16:27:17: (response.c.250) -- sanatising URI 
2006-12-03 16:27:17: (response.c.251) URI-path     :  / 
2006-12-03 16:27:17: (configfile-glue.c.430) === start of 1 condition block === 
2006-12-03 16:27:17: (configfile-glue.c.382) HTTP["url"] ( / ) compare to \.php$ 
2006-12-03 16:27:17: (configfile-glue.c.445) 1 result: false 
2006-12-03 16:27:17: (configfile-glue.c.451) 1 (cached) result: false 
2006-12-03 16:27:17: (configfile-glue.c.451) 1 (cached) result: false 
2006-12-03 16:27:17: (configfile-glue.c.451) 1 (cached) result: false 
2006-12-03 16:27:17: (response.c.367) -- before doc_root 
2006-12-03 16:27:17: (response.c.368) Doc-Root     : /var/www/test.com/htdocs
2006-12-03 16:27:17: (response.c.369) Rel-Path     : / 
2006-12-03 16:27:17: (response.c.370) Path         :  
2006-12-03 16:27:17: (response.c.423) -- after doc_root 
2006-12-03 16:27:17: (response.c.424) Doc-Root     : /var/www/test.com/htdocs
2006-12-03 16:27:17: (response.c.425) Rel-Path     : / 
2006-12-03 16:27:17: (response.c.426) Path         : /var/www/test.com/htdocs
2006-12-03 16:27:17: (configfile-glue.c.451) 1 (cached) result: false 
2006-12-03 16:27:17: (configfile-glue.c.451) 1 (cached) result: false 
2006-12-03 16:27:17: (response.c.443) -- logical -> physical 
2006-12-03 16:27:17: (response.c.444) Doc-Root     : /var/www/test.com/htdocs
2006-12-03 16:27:17: (response.c.445) Rel-Path     : / 
2006-12-03 16:27:17: (response.c.446) Path         : /var/www/test.com/htdocs
2006-12-03 16:27:17: (response.c.464) -- handling physical path 
2006-12-03 16:27:17: (response.c.465) Path         : /var/www/test.com/htdocs
2006-12-03 16:27:17: (response.c.472) -- file found 
2006-12-03 16:27:17: (response.c.473) Path         : /var/www/test.com/htdocs
2006-12-03 16:27:17: (response.c.616) -- handling subrequest 
2006-12-03 16:27:17: (response.c.617) Path         : /var/www/test.com/htdocs
2006-12-03 16:27:17: (configfile-glue.c.451) 1 (cached) result: false 
2006-12-03 16:27:17: (mod_indexfile.c.159) -- handling the request as Indexfile 
2006-12-03 16:27:17: (mod_indexfile.c.160) URI          : / 
2006-12-03 16:27:17: (configfile-glue.c.430) === start of 1 condition block === 
2006-12-03 16:27:17: (configfile-glue.c.382) HTTP["url"] ( /index.php ) compare to \.php$ 
2006-12-03 16:27:17: (configfile-glue.c.445) 1 result: true 
mod_proxy_core.c.1425: (error) handling it in mod_proxy_core: uri.path=/index.php
2006-12-03 16:27:17: (response.c.628) -- subrequest finished 
2006-12-03 16:27:17: (connections.c.1051) state at start 12 read-content 
2006-12-03 16:27:17: (connections.c.1051) state at start 12 read-content 


valgrind --leak-check=full ./lighttpd -D -f lighttpd.conf
==15889== Memcheck, a memory error detector for x86-linux.
==15889== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==15889== Using valgrind-2.4.0, a program supervision framework for x86-linux.
==15889== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==15889== For more details, rerun with: -v
==15889==
==15889== Conditional jump or move depends on uninitialised value(s)
==15889==    at 0x1B9E4D70: strstr (in /lib/libc-2.4.so)
==15889==    by 0x1B969AB8: __pthread_initialize_minimal (in /lib/libpthread-2.4.so)
==15889==    by 0x1B9695B7: ??? (crti.S:18)
==15889==    by 0x1B969167: ??? (crti.S:30)
==15889==    by 0x1B8F1884: call_init (in /lib/ld-2.4.so)
==15889==    by 0x1B8F19AD: _dl_init (in /lib/ld-2.4.so)
==15889==    by 0x1B8E48FE: (within /lib/ld-2.4.so)
==15889==
==15889== Conditional jump or move depends on uninitialised value(s)
==15889==    at 0x1B9E4D74: strstr (in /lib/libc-2.4.so)
==15889==    by 0x1B969AB8: __pthread_initialize_minimal (in /lib/libpthread-2.4.so)
==15889==    by 0x1B9695B7: ??? (crti.S:18)
==15889==    by 0x1B969167: ??? (crti.S:30)
==15889==    by 0x1B8F1884: call_init (in /lib/ld-2.4.so)
==15889==    by 0x1B8F19AD: _dl_init (in /lib/ld-2.4.so)
==15889==    by 0x1B8E48FE: (within /lib/ld-2.4.so)
mod_proxy_core_address.c.158: (trace) resolving 127.0.0.1 on port 1026
mod_proxy_core_address.c.63: (trace) adding 127.0.0.1:1026 to the address-pool
==15889==
==15889== Invalid write of size 4
==15889==    at 0x1B9216CB: proxy_parse_response_header (mod_proxy_core.c:592)
==15889==    by 0x1B921E75: proxy_state_engine (mod_proxy_core.c:1104)
==15889==    by 0x1B9221E9: mod_proxy_core_start_backend (mod_proxy_core.c:1586)
==15889==    by 0x80600E9: plugins_call_handle_send_request_content (plugin.c:297)
==15889==    by 0x8053490: connection_state_machine (connections.c:1299)
==15889==    by 0x804E270: lighty_mainloop (server.c:1040)
==15889==    by 0x804FB1E: main (server.c:1673)
==15889==  Address 0x30 is not stack'd, malloc'd or (recently) free'd
==15889==
==15889== Process terminating with default action of signal 11 (SIGSEGV)
==15889==  Access not within mapped region at address 0x30
==15889==    at 0x1B9216CB: proxy_parse_response_header (mod_proxy_core.c:592)
==15889==    by 0x1B921E75: proxy_state_engine (mod_proxy_core.c:1104)
==15889==    by 0x1B9221E9: mod_proxy_core_start_backend (mod_proxy_core.c:1586)
==15889==    by 0x80600E9: plugins_call_handle_send_request_content (plugin.c:297)
==15889==    by 0x8053490: connection_state_machine (connections.c:1299)
==15889==    by 0x804E270: lighty_mainloop (server.c:1040)
==15889==    by 0x804FB1E: main (server.c:1673)
==15889==
==15889== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 49 from 1)
==15889== malloc/free: in use at exit: 304698 bytes in 6237 blocks.
==15889== malloc/free: 7450 allocs, 1213 frees, 397949 bytes allocated.
==15889== For counts of detected errors, rerun with: -v
==15889== searching for pointers to 6237 not-freed blocks.
==15889== checked 8836496 bytes.
==15889==
==15889==
==15889== 128 bytes in 2 blocks are definitely lost in loss record 92 of 130
==15889==    at 0x1B909368: malloc (vg_replace_malloc.c:130)
==15889==    by 0x805B152: buffer_pool_append (buffer.c:1151)
==15889==    by 0x806A432: http_req_parser (http_req_parser.y:50)
==15889==    by 0x80699AB: http_request_parse_cq (http_req.c:252)
==15889==    by 0x8052224: connection_handle_read_request_header (connections.c:627)
==15889==    by 0x805355B: connection_state_machine (connections.c:1126)
==15889==    by 0x804E270: lighty_mainloop (server.c:1040)
==15889==    by 0x804FB1E: main (server.c:1673)
==15889==
==15889==
==15889== 136 bytes in 1 blocks are possibly lost in loss record 97 of 130
==15889==    at 0x1B909E9A: calloc (vg_replace_malloc.c:176)
==15889==    by 0x1B8F4528: allocate_dtv (in /lib/ld-2.4.so)
==15889==    by 0x1B8F45EB: _dl_allocate_tls (in /lib/ld-2.4.so)
==15889==    by 0x1B96A9FF: pthread_create@@GLIBC_2.1 (in /lib/libpthread-2.4.so)
==15889==    by 0x804E8A3: lighty_mainloop (server.c:657)
==15889==    by 0x804FB1E: main (server.c:1673)
==15889==
==15889== LEAK SUMMARY:
==15889==    definitely lost: 128 bytes in 2 blocks.
==15889==      possibly lost: 136 bytes in 1 blocks.
==15889==    still reachable: 304434 bytes in 6234 blocks.
==15889==         suppressed: 0 bytes in 0 blocks.
==15889== Reachable blocks (those to which a pointer was found) are not shown.
==15889== To see them, rerun with: --show-reachable=yes

-- boom

Actions #7

Updated by jakabosky over 17 years ago

I fixed those two segmentation faults and some memory bugs.

Actions #8

Updated by jakabosky over 17 years ago

oops, I mean the segmentation fault and the linux-aio bug.

Actions #9

Updated by Anonymous over 17 years ago

100% cpu utilization with 1.5 and php 5.2 in mod_proxy_core
in lighttpd.error.log this line

mod_proxy_backend_fastcgi.c.399: (trace) need more

I enabled linux-aio and use non-socks connection in fast-cgi.

-- boom

Actions #10

Updated by jakabosky over 17 years ago

Fixed the 100% cpu utilization with 1.5 and php 5.2 in mod_proxy_core bug.

I did a major rewrite of the fastcgi packet decoding code. It should be faster and more stable.

Please test and let me know how it works

Actions #11

Updated by Anonymous over 17 years ago

New bug

If page not found I see

"No input file specified."

not 404 error page

-- boom

Actions #12

Updated by Anonymous over 17 years ago

Replying to :

New bug

If page not found I see

"No input file specified."

not 404 error page


2006-12-07 18:06:14: (response.c.150) run condition
2006-12-07 18:06:14: (response.c.196) -- splitting Request-URI
2006-12-07 18:06:14: (response.c.197) Request-URI  :  /cstats.php
2006-12-07 18:06:14: (response.c.198) URI-scheme   :  http
2006-12-07 18:06:14: (response.c.199) URI-authority:  test.com
2006-12-07 18:06:14: (response.c.200) URI-path     :  /cstats.php
2006-12-07 18:06:14: (response.c.201) URI-query    :
2006-12-07 18:06:14: (response.c.251) -- sanatising URI
2006-12-07 18:06:14: (response.c.252) URI-path     :  /cstats.php
2006-12-07 18:06:14: (configfile-glue.c.430) === start of 1 condition block ===
2006-12-07 18:06:14: (configfile-glue.c.382) HTTP["url"] ( /cstats.php ) compare to \.php$
2006-12-07 18:06:14: (configfile-glue.c.445) 1 result: true
2006-12-07 18:06:14: (configfile-glue.c.451) 1 (cached) result: true
2006-12-07 18:06:14: (configfile-glue.c.451) 1 (cached) result: true
2006-12-07 18:06:14: (configfile-glue.c.451) 1 (cached) result: true
2006-12-07 18:06:14: (configfile-glue.c.451) 1 (cached) result: true
2006-12-07 18:06:14: (response.c.368) -- before doc_root
2006-12-07 18:06:14: (response.c.369) Doc-Root     : /var/www/test.com/htdocs
2006-12-07 18:06:14: (response.c.370) Rel-Path     : /cstats.php
2006-12-07 18:06:14: (response.c.371) Path         :
2006-12-07 18:06:14: (response.c.424) -- after doc_root
2006-12-07 18:06:14: (response.c.425) Doc-Root     : /var/www/test.com/htdocs
2006-12-07 18:06:14: (response.c.426) Rel-Path     : /cstats.php
2006-12-07 18:06:14: (response.c.427) Path         : /var/www/test.com/htdocs/cstats.php
2006-12-07 18:06:14: (configfile-glue.c.451) 1 (cached) result: true
mod_proxy_core.c.1436: (trace) handling it in mod_proxy_core: uri.path=/cstats.php
2006-12-07 18:06:14: (configfile-glue.c.451) 1 (cached) result: true
2006-12-07 18:06:14: (response.c.444) -- logical -> physical
2006-12-07 18:06:14: (response.c.445) Doc-Root     : /var/www/test.com/htdocs
2006-12-07 18:06:14: (response.c.446) Rel-Path     : /cstats.php
2006-12-07 18:06:14: (response.c.447) Path         : /var/www/test.com/htdocs/cstats.php
2006-12-07 18:06:14: (connections.c.1076) state at start 12 read-content
2006-12-07 18:06:14: (response.c.114) Response-Header:
HTTP/1.1 404 Not Found
Transfer-Encoding: chunked
X-Powered-By: PHP/5.2.0
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-type: text/html; charset=utf-8
Date: Thu, 07 Dec 2006 16:06:14 GMT
Server: lighttpd/1.5.0

2006-12-07 18:06:14: (connections.c.1429) state for fd 12 resp-end
2006-12-07 18:06:14: (configfile-glue.c.451) 1 (cached) result: true
2006-12-07 18:06:14: (connections.c.1101) state for fd 12 req-start
connections.c.1148: (trace) state for fd=12: read-header
2006-12-07 18:06:15: (connections.c.1076) state at start 12 read-header
connections.c.1148: (trace) state for fd=12: read-header
2006-12-07 18:06:20: (connections.c.1076) state at start 12 error
2006-12-07 18:06:20: (connections.c.1553) shutdown for fd 12
2006-12-07 18:06:20: (connections.c.1464) state for fd 12 close
2006-12-07 18:06:20: (connections.c.1493) connection closed for fd 12
2006-12-07 18:06:20: (connections.c.1089) state for fd 12 connect
2006-12-07 18:06:20: (connections.c.1580) state at exit: 12 connect

-- boom

Actions #13

Updated by Anonymous over 17 years ago

in error_log many lines

2006-12-07 18:26:42: (connections.c.1076) state at start 12 write-content

Used linux-aio and php script

On html and images all ok

-- boom

Actions #14

Updated by jakabosky over 17 years ago

Replying to :

in error_log many lines

2006-12-07 18:26:42: (connections.c.1076) state at start 12 write-content

This is not an error. It is normal to see this atleast once for small content and many times for large content. If the response content is larger then the connection's send buffer, then lighttpd will wait for a write event to send more content and you will see this message again.

Actions #15

Updated by jakabosky over 17 years ago

Replying to :

New bug

If page not found I see

"No input file specified."

not 404 error page

The problem is that mod_proxy_core doesn't support "check-local" like mod_fastcgi did. The 404 error and message is from php-cgi.

Either we add "proxy-core.check-local", or we have mod_proxy_core catch the 404 from php and handle it like a normal lighttpd 404 and use the error-handler to handle it.

using "check-local" would be more efficient then sending the request to php and then reprocessing it.

Actions #16

Updated by jakabosky over 17 years ago

I have added "proxy-core.check-local" to mod_proxy_core. It is disabled by default.


$HTTP["url"] =~ "\.php$" {
    proxy-core.balancer = "round-robin" 
    proxy-core.protocol = "fastcgi" 
    proxy-core.check-local = "enable" 
    proxy-core.backends = ( "unix:/tmp/php-fastcgi.sock" )
}

when enabled lighttpd will check if the php file exists before sending the request to the backend.

Actions #17

Updated by jakabosky over 17 years ago

I have added support for SCGI backends. Just load module mod_proxy_backend_scgi

No process spawning support yet.

Actions #18

Updated by Anonymous over 17 years ago

check-local not work
same message 'No input file specified.'


2006-12-09 12:35:45: (configfile-glue.c.451) 1 (cached) result: true
mod_proxy_core.c.1436: (trace) handling it in mod_proxy_core: uri.path=/sdfsdf.php
2006-12-09 12:35:45: (configfile-glue.c.451) 1 (cached) result: true
2006-12-09 12:35:45: (response.c.444) -- logical -> physical
2006-12-09 12:35:45: (response.c.445) Doc-Root     : /var/www/test.com/htdocs
2006-12-09 12:35:45: (response.c.446) Rel-Path     : /sdfsdf.php
2006-12-09 12:35:45: (response.c.447) Path         : /var/www/test.com/htdocs/sdfsdf.php
2006-12-09 12:35:45: (connections.c.1076) state at start 12 read-content
2006-12-09 12:35:45: (response.c.114) Response-Header:
HTTP/1.1 404 Not Found
Transfer-Encoding: chunked
X-Powered-By: PHP/5.2.0
Set-Cookie: PHPSESSID=d6110b184c818bd0b7aadad26d25c62e; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-type: text/html; charset=utf-8
Date: Sat, 09 Dec 2006 10:35:45 GMT
Server: lighttpd/1.5.0

2006-12-09 12:35:45: (connections.c.1429) state for fd 12 resp-end
2006-12-09 12:35:45: (configfile-glue.c.451) 1 (cached) result: true
2006-12-09 12:35:45: (connections.c.1101) state for fd 12 req-start
connections.c.1148: (trace) state for fd=12: read-header
2006-12-09 12:35:46: (connections.c.1076) state at start 12 read-header
connections.c.1148: (trace) state for fd=12: read-header
2006-12-09 12:35:51: (connections.c.1076) state at start 12 error
2006-12-09 12:35:51: (connections.c.1553) shutdown for fd 12
2006-12-09 12:35:51: (connections.c.1464) state for fd 12 close
2006-12-09 12:35:51: (connections.c.1493) connection closed for fd 12
2006-12-09 12:35:51: (connections.c.1089) state for fd 12 connect
2006-12-09 12:35:51: (connections.c.1580) state at exit: 12 connect

-- boom

Actions #19

Updated by jakabosky over 17 years ago

Can you post your prox-core settings.


mod_proxy_core.c.1436: (trace) handling it in mod_proxy_core: uri.path=/sdfsdf.php

That line means check-local was disabled. I have updated my example configfile

Actions #20

Updated by Anonymous over 17 years ago

My current config


$HTTP["url"] =~ "\.php$" {
    proxy-core.balancer = "round-robin" 
    proxy-core.protocol = "fastcgi" 
    proxy-core.backends = ( "unix:/tmp/fcgi.sock" )
    proxy-core.max-pool-size = 16
    proxy-core.allow-x-sendfile ="enable" 
proxy-core.check-local = "enable" 
}

but check-local not work

-- boom

Actions #21

Updated by Anonymous over 17 years ago

I found a new bug

When I accessing
http://test.com/good.php?w=show

if $_GET I see


Array ( [/good_php?w] => show )

tested with PHP 5.2.0 and 5.1.6

in Apache2 I see


Array ( [w] => show )

-- boom

Actions #22

Updated by Anonymous over 17 years ago

Sorry, last bug it is my error in rewrite rules

-- boom

Actions #23

Updated by jakabosky over 17 years ago

Replying to :

My current config

{{{
$HTTPurl =~ "\.php$" {
proxy-core.balancer = "round-robin"
proxy-core.protocol = "fastcgi"
proxy-core.backends = ( "unix:/tmp/fcgi.sock" )
proxy-core.max-pool-size = 16
proxy-core.allow-x-sendfile ="enable"
proxy-core.check-local = "enable"
}

but check-local not work
}}}

can you turn on only these three debug settings:


debug.log-request-handling = "enable" 
debug.log-condition-handling = "enable" 
debug.log-condition-cache-handling = "enable" 

I think you might have two conditional blocks matching the request. The other conditional blocks don't even need "proxy-core" settings.

Actions #24

Updated by Anonymous over 17 years ago

log results


2006-12-12 10:51:22: (response.c.150) run condition
2006-12-12 10:51:22: (response.c.196) -- splitting Request-URI
2006-12-12 10:51:22: (response.c.197) Request-URI  :  /dgdg.php
2006-12-12 10:51:22: (response.c.198) URI-scheme   :  http
2006-12-12 10:51:22: (response.c.199) URI-authority:  test.com
2006-12-12 10:51:22: (response.c.200) URI-path     :  /dgdg.php
2006-12-12 10:51:22: (response.c.201) URI-query    :
2006-12-12 10:51:22: (response.c.251) -- sanatising URI
2006-12-12 10:51:22: (response.c.252) URI-path     :  /dgdg.php
2006-12-12 10:51:22: (configfile-glue.c.430) === start of 1 condition block ===
2006-12-12 10:51:22: (configfile-glue.c.382) HTTP["url"] ( /dgdg.php ) compare to \.php$
2006-12-12 10:51:22: (configfile-glue.c.445) 1 result: true
2006-12-12 10:51:22: (configfile-glue.c.451) 1 (cached) result: true
2006-12-12 10:51:22: (configfile-glue.c.451) 1 (cached) result: true
2006-12-12 10:51:22: (configfile-glue.c.451) 1 (cached) result: true
2006-12-12 10:51:22: (configfile-glue.c.451) 1 (cached) result: true
2006-12-12 10:51:22: (response.c.368) -- before doc_root
2006-12-12 10:51:22: (response.c.369) Doc-Root     : /var/www/test.com/htdocs
2006-12-12 10:51:22: (response.c.370) Rel-Path     : /dgdg.php
2006-12-12 10:51:22: (response.c.371) Path         :
2006-12-12 10:51:22: (response.c.424) -- after doc_root
2006-12-12 10:51:22: (response.c.425) Doc-Root     : /var/www/test.com/htdocs
2006-12-12 10:51:22: (response.c.426) Rel-Path     : /dgdg.php
2006-12-12 10:51:22: (response.c.427) Path         : /var/www/test.com/htdocs/dgdg.php
2006-12-12 10:51:22: (configfile-glue.c.451) 1 (cached) result: true
mod_proxy_core.c.1436: (trace) handling it in mod_proxy_core: uri.path=/dgdg.php
2006-12-12 10:51:22: (configfile-glue.c.451) 1 (cached) result: true
2006-12-12 10:51:22: (response.c.444) -- logical -> physical
2006-12-12 10:51:22: (response.c.445) Doc-Root     : /var/www/test.com/htdocs
2006-12-12 10:51:22: (response.c.446) Rel-Path     : /dgdg.php
2006-12-12 10:51:22: (response.c.447) Path         : /var/www/test.com/htdocs/dgdg.php
2006-12-12 10:51:22: (configfile-glue.c.451) 1 (cached) result: true

-- boom

Actions #25

Updated by jakabosky over 17 years ago

can you apply this small patch to add two debug message. It will help me find out why check-local it not working for you.


--- src/mod_proxy_core.c.orig    2006-12-12 18:17:19.000000000 -0800
+++ src/mod_proxy_core.c    2006-12-12 18:22:48.000000000 -0800
@@ -1401,6 +1401,7 @@
                 PATCH_OPTION(allow_x_rewrite);
             } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_PROXY_CORE_CHECK_LOCAL))) {
                 PATCH_OPTION(check_local);
+                TRACE("mod_proxy_core: config key=%s, set check_local=%d", BUF_STR(du->key), p->conf.check_local);
             }
         }
     }
@@ -1424,6 +1425,7 @@
     /* no proxy backends to handle this request. */
     if (p->conf.backends->used == 0) return HANDLER_GO_ON;

+    TRACE("mod_proxy_core: file_match=%d, check_local=%d", file_match, p->conf.check_local);
     /* if check_local is enabled, then wait for file match. */
     if (file_match != p->conf.check_local) return HANDLER_GO_ON;

Actions #26

Updated by jakabosky over 17 years ago

patch lighttpd-1.5.0-r1464.diff.gz has been merged into svn revision 1468

Actions #27

Updated by Anonymous over 17 years ago

check-local work fine in 1469

-- boom

Actions #28

Updated by Anonymous over 17 years ago

New error in 1490 when I try to compile with PCRE

but with 1477 all ok


 gcc -DHAVE_CONFIG_H -DLIBRARY_DIR=\"/usr/local/lib\" -I. -I. -I.. -D_REENTRANT -D__EXTENSIONS__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -g -O2 -Wall -W -Wshadow -pedantic -std=gnu99 -MT mod_proxy_core_rewrites.lo -MD -MP -MF .deps/mod_proxy_core_rewrites.Tpo -c mod_proxy_core_rewrites.c  -fPIC -DPIC -o .libs/mod_proxy_core_rewrites.o
In file included from mod_proxy_core_rewrites.c:5:
mod_proxy_core_rewrites.h:17: error: expected specifier-qualifier-list before 'pcre'
mod_proxy_core_rewrites.h:33: error: expected ')' before '*' token
mod_proxy_core_rewrites.c: In function 'proxy_rewrite_init':
mod_proxy_core_rewrites.c:12: error: 'proxy_rewrite' has no member named 'match'
mod_proxy_core_rewrites.c:13: error: 'proxy_rewrite' has no member named 'replace'
mod_proxy_core_rewrites.c: In function 'proxy_rewrite_free':
mod_proxy_core_rewrites.c:21: error: 'proxy_rewrite' has no member named 'regex'
mod_proxy_core_rewrites.c:21: warning: implicit declaration of function 'pcre_free'
mod_proxy_core_rewrites.c:21: error: 'proxy_rewrite' has no member named 'regex'
mod_proxy_core_rewrites.c:25: error: 'proxy_rewrite' has no member named 'match'
mod_proxy_core_rewrites.c:26: error: 'proxy_rewrite' has no member named 'replace'
mod_proxy_core_rewrites.c: In function 'proxy_rewrite_set_regex':
mod_proxy_core_rewrites.c:36: error: 'proxy_rewrite' has no member named 'regex'
mod_proxy_core_rewrites.c:36: warning: implicit declaration of function 'pcre_compile'
mod_proxy_core_rewrites.c: At top level:
mod_proxy_core_rewrites.c:71: error: expected ')' before '*' token
make[2]: *** [mod_proxy_core_rewrites.lo] Error 1
make[2]: Leaving directory `/root/lig/lighttpd-svn/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/lig/lighttpd-svn'
make: *** [all] Error 2

-- boom

Actions #29

Updated by Anonymous over 17 years ago

See http://forum.lighttpd.net/topic/4346 for solving last error

-- boom

Actions #30

Updated by Anonymous over 17 years ago

Bug: 100% CPU utilization when pushing STOP button in browser

error_log


2007-01-04 19:36:57: (connections.c.1082) state at start 15 write-content
mod_proxy_backend_fastcgi.c.498: (trace) unknown packet.type: 52
mod_proxy_core.c.1215: (trace) stream-decode: -1
mod_proxy_core.c.1638: (trace) state: 6 (error)
2007-01-04 19:36:57: (connections.c.1082) state at start 15 write-content
mod_proxy_backend_fastcgi.c.498: (trace) unknown packet.type: 52
mod_proxy_core.c.1215: (trace) stream-decode: -1
mod_proxy_core.c.1638: (trace) state: 6 (error)
2007-01-04 19:36:57: (connections.c.1082) state at start 15 write-content
mod_proxy_backend_fastcgi.c.498: (trace) unknown packet.type: 52
mod_proxy_core.c.1215: (trace) stream-decode: -1
mod_proxy_core.c.1638: (trace) state: 6 (error)
2007-01-04 19:36:57: (connections.c.1082) state at start 15 write-content
mod_proxy_backend_fastcgi.c.498: (trace) unknown packet.type: 52

-- boom

Actions #31

Updated by jakabosky over 17 years ago

  • Status changed from New to Fixed
  • Resolution set to fixed

boom,
re-open this ticket if that problem still happens for you with revision 1513. Also make sure
to post the very first set of error messages. Sometime the repeating error messages are caused by
one error message at the top.

Actions

Also available in: Atom