https://redmine.lighttpd.net/https://redmine.lighttpd.net/favicon.ico?13667327412006-09-19T04:48:00Zlighty labsLighttpd - Bug #841: Segmentation fault using fastcgi / php5-cgihttps://redmine.lighttpd.net/issues/841?journal_id=19202006-09-19T04:48:00ZAnonymous
<ul></ul><p>I think its because php5-cgi hasn't been built with lighttpd support; the Ubuntu package depends on php4-cgi. I had the same problem on my first attempt. In any case, you can get it working - and probably working a heck of a lot faster - by using a socket instead of a port connection.<br />ie, make the config:</p>
<pre><code>fastcgi.server = (</code></pre>
<pre><code>".php" => (</code></pre>
<pre><code>"localhost" => (</code></pre>
<pre><code>"bin-path" => "/usr/bin/php5-cgi",[[[BR]]]<br /> "socket" => "/tmp/php5-fcgi.socket",[[[BR]]]<br /> )))</code></pre> Lighttpd - Bug #841: Segmentation fault using fastcgi / php5-cgihttps://redmine.lighttpd.net/issues/841?journal_id=19212006-09-19T07:56:26Zjan
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Assigned</i></li></ul><p>Good catch, can you rebuild the strace with the option -s 512:</p>
<p>$ strace -s 512 -tt ...</p>
<p>Without the -s 512 the strings are cut off too early:</p>
<p>424 write(5, "2006-09-08 14:36:46: (mod_fastcg"..., 80) = 80<br />425 --- SIGSEGV (Segmentation fault) @ 0 (0) ---<br />426 +<ins>+ killed by SIGSEGV +</ins>+</p>
<p>and can you use the debug-version of lighty when you run valgrind ?</p>
<p>If you compiled from source a lighttpd-binary with debug-symbols is in the src/ folder:</p>
<p>$ file src/lighttpd<br />lighttpd: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), for GNU/Linux 2.2.5, not stripped</p>
<p>Otherwise I don't get line-numbers for the segfault as you see below:</p>
<p>1192 11737 1 errors in context 1 of 10:<br />1193 11737 Invalid write of size 4<br />1194 11737 at 0x45168B0: (within /usr/lib/lighttpd/mod_fastcgi.so)<br />1195 11737 by 0x805E5D6: plugins_call_handle_subrequest (in /usr/sbin/lighttpd)<br />1196 11737 by 0x804FCB6: http_response_prepare (in /usr/sbin/lighttpd)<br />1197 11737 by 0x805261C: connection_state_machine (in /usr/sbin/lighttpd)<br />1198 11737 by 0x80535A5: network_server_handle_fdevent (in /usr/sbin/lighttpd)<br />1199 11737 by 0x804E01E: main (in /usr/sbin/lighttpd)<br />1200 11737 Address 0x28 is not stack'd, malloc'd or (recently) free'd</p> Lighttpd - Bug #841: Segmentation fault using fastcgi / php5-cgihttps://redmine.lighttpd.net/issues/841?journal_id=19222007-08-13T11:42:21Zdarix
<ul></ul><p>please retest this bug on a newer release.</p> Lighttpd - Bug #841: Segmentation fault using fastcgi / php5-cgihttps://redmine.lighttpd.net/issues/841?journal_id=19232007-08-25T10:52:41Zstbuehler
<ul></ul><p>confirmed for 1.4.16</p>
<p>The problem is, that it is not clear in the source, if it is ok to not specify "host".<br />The config sanity check requires the following:<br /> - that you do not set (host or port) AND unixsocket,<br /> - if unixsocket is not set -> tcp/ip<br /> - you set at least "host" or "bin-path" <br /> - port != 0<br />The struct docu says that for tcp/ip host AND port are needed.</p>
<p>Now some code (like fcgi_spawn_connection), accepts unspecified host for tcp, but not all code does, e.g. fcgi_write_request.</p>
<p>Try the patch below, which uses INADDR_LOOPBACK if host is not specified.<br />Another possibility would be to spawn the fcgi-process with bind(INADDR_ANY) and connect to INADDR_LOOPBACK (just remove the second part of the patch, which changes INADDR_ANY to INADDR_LOOPBACK).</p>
<p>One problem remains: if the fastcgi-process does not die while the server gets restarted, the proc is marked as not local; if the fastcgi-process dies now, the server wont restart it, as it is not local, although it has a bin_path.</p> Lighttpd - Bug #841: Segmentation fault using fastcgi / php5-cgihttps://redmine.lighttpd.net/issues/841?journal_id=19242008-01-15T23:10:05Zstbuehler
<ul></ul><p>I just read through the mod_fastcgi diff since 1.4.16 and i didn't find a fix for this, so i think it is just there (i did not test it again).<br />Updated patch for current svn.</p> Lighttpd - Bug #841: Segmentation fault using fastcgi / php5-cgihttps://redmine.lighttpd.net/issues/841?journal_id=19252008-01-16T01:00:11Zglen
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>New</i></li></ul> Lighttpd - Bug #841: Segmentation fault using fastcgi / php5-cgihttps://redmine.lighttpd.net/issues/841?journal_id=19262008-01-16T01:00:52Zglen
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Fixed</i></li><li><strong>Resolution</strong> set to <i>fixed</i></li></ul><p>Committed revision r2037.</p>