Bug #1716
closedmod_scgi process spawning without replacing fd=0 (stdin) by socket as in fcgi
Description
mod_scgi is quite similar to mod_fastcgi however, it has an important issue:
When scgi process is spawned its stdin fd do not replaced with socket.
Little description: there are two ways to connect to f/scgi process:
1. By predefined socket
2. By opening stdin as an input socket: this method is usually used in
most of cases when lighty spwans fastcgi process.
So operations are:
1. Create socket /tmp/somesock
2. Bind to socket
3. Fork a process
4. Close fd=0 and copy our new socket to fd=0 (stdin) by dup2
5. Exec a process when fd=0 is socket and fastcgi process can call accept(2)
on this fd (part of standard fastcgi method)
However 4th step is not done in case of scgi which makes facility of spawning of several scgi process by web server quite usless (unless I accidentially guess
what is the socket should be opened for lighty)
-- artyomtnk
Files
Updated by Anonymous over 16 years ago
Simple code to reproduce the problem:
Lighttpd configuration:
server.modules = ("mod_scgi") server.document-root = "./" server.port = 8080 server.bind = "127.0.0.1" scgi.server = ( "/bb" => ( "localhost" => ( "check-local" => "disable", "bin-path" => "./a.out", "socket" => "/tmp/bb-fastcgi.socket" )))
VERY Simple C SCGI application:
#include <stdio.h> #include <unistd.h> #include <sys/socket.h> #include <stdlib.h> #include <string.h> char buffer[16384]; int main() { for(;;) { int s=accept(0,NULL,NULL); if(s<0) { perror("accept"); exit(1); } char const msg[]="Content-Type: text/html\r\n\r\n<h1>Hello World</h1>\r\n"; read(s,buffer,16384); write(s,msg,strlen(msg)); close(s); } }
Before patch application exists with the error.
After, accessing to http://127.0.0.1:8080/bb works fine
-- artyomtnk
Updated by Anonymous over 16 years ago
Anybody?
Is there any chance that the issue will be fixed?
This bug makes server side scgi process spawning useless.
Updated by stbuehler over 16 years ago
- Status changed from New to Fixed
- Resolution set to fixed
Fixed in r2257
Also available in: Atom