Re: mod_fastcgi 2.0 beta 1

Ken Alexander (kalex@eecs.umich.edu)
Thu, 1 May 1997 11:46:44 -0400 (EDT)

Date: Thu, 1 May 1997 11:46:44 -0400 (EDT)
From: Ken Alexander <kalex@eecs.umich.edu>
Message-Id: <199705011546.LAA07410@quip.eecs.umich.edu>
To: fastcgi-developers@OpenMarket.com, gambarin@OpenMarket.com
Subject: Re:  mod_fastcgi 2.0 beta 1

This is in regards to the perl5.003 / sfio / solaris 2.5 
multiple-fcgi-process hanging death problem.

Gambarin writes:
> 2. In my very limited testing of the dynamic applications, I came across
> a possible bug, where the two almost silmultaneous accesses were made to
> the same fastcgi application.  The application code was of the form 
> 	print("text/html\r\n");
> 	sleep(10);
> 	print("Hello world");
> 	The version of the above program written in C ran fine, spawning off 2 
> copies of the application and servicing them.  However, the same program
> written in Perl (Perl 5.003_26 with Sfio 0.28 under Solaris 2.5) resulting
> in hanging the server and never returning the request.   Furthermore, any
> subsequent requests to any other fastcgi application did not go through.
> I am assumming that there might be some race condition in Perl's accept()
> loop, however I don't have to time to delve into it (see below).


Guess what - it isn't just in dynamic applications.  
I have this same problem with regular "AppClass" applications under 
perl5.003_95 / sfio0.28 / solaris2.5.1.  Multiple apps die and client hangs.
This makes it quite unusable (which is why I had to go back to perl5.002
and instead found the bug in Configure that caused signals to be broken).

Here's a report about the problem from my coworker:


========== begin forwarded article:

From: Spencer W Thomas <spencer@umich.edu>
Newsgroups: comp.infosystems.www.servers.unix,comp.lang.perl.misc
Subject: perl5-sfio / fcgi problem.
Date: Thu, 10 Apr 1997 17:21:19 -0400
Organization: University of Michigan
Lines: 105

System specifics are at the end.

The symptom: fcgi_accept returns an error: "protocol error", the client
connection hangs waiting for a response.  This only happens when more than
one copy of the fcgi process is running (i.e., -processes 2, but not
with -processes 1).

A test script ("trivial.fcg"):

use FCGI;
 
main: {
 
    while (each(%ENV)) {}       # Workaround accept bug.
    while(FCGI::accept() >= 0) {
        open(ERR, ">>trivial.log");
        printf(ERR "Process %d accept\n", $$);
        close(ERR);
 
        print <<EOF;
Content-type: text/html
 
It's working now.
EOF
        print `date`;
    }                   # end of Fast CGI loop
    open(ERR, ">>trivial.log");
    printf(ERR "Process %d error %s\n", $$, $!);
    close(ERR);
}                               # END: main

The AppClass line:
AppClass /l/httpd/mirror/fcgi-bin/trivial.fcg -processes 2

tail -f error_log intermixed with tail -f trivial.log:
[Thu Apr 10 17:01:09 1997] Server configured -- resuming normal
operations
Process 9329 error Protocol error
[Thu Apr 10 17:01:11 1997] mod_fastcgi:
/l/httpd/mirror/fcgi-bin/trivial.fcg pid 9329 terminated by calling exit
with status = 0.
[Thu Apr 10 17:01:13 1997] mod_fastcgi:
/l/httpd/mirror/fcgi-bin/trivial.fcg restarted with pid 9337.

% netstat -f unix -v
Active UNIX domain sockets
Address  Type          Vnode     Conn Addr
502f1778 stream-ord        0 5076f788
/l/httpd/mirror/fcgi-ipc/OM_WS_4.8964
5076f788 stream-ord        0 502f1778 
5076f388 stream-ord  6559057        0
/l/httpd/mirror/fcgi-ipc/OM_WS_4.8964

Running perl under dbx determines that the (C-language) accept() call is
failing with
an error code corresponding to "protocol error".

Any ideas?  Any help?

Thanks.

Version information:
% uname -a
SunOS index.umdl.umich.edu 5.5.1 Generic_103640-01 sun4u sparc
SUNW,Ultra-2

% /l/p5sf/bin/perl -version
This is perl, version 5.003_95


Apache Server Information

Server Settings, fastcgi_module, info_module, status_module,
config_log_module, action_module, imap_module, asis_module, env_module,
alias_module, userdir_module, cgi_module, dir_module, includes_module,
negotiation_module, auth_module, access_module, mime_module, core_module

Server Version: Apache/1.1.1-3 [IP-range]/0.1 FastCGI/1.4
API Version: 19960526
Run Mode: standalone
Daemons: start: 5    min idle: 5    max idle: 10    max: 150
Max Requests: per child: 30    per connection: 16

Module Name: fastcgi_module 
Content-types affected: application/x-httpd-fcgi , fastcgi-script 
Module Groups: none
Module Configuration Commands: 
      FastCgiIpcDir - 
      AppClass - 
      ExternalAppClass - 
Current Configuration: 
httpd.conf 
      FastCgiIpcDir /l/httpd/mirror/fcgi-ipc
srm.conf 
      AppClass /l/httpd/mirror/fcgi-bin/trivial.fcg -processes 2

-- 
=Spencer W. Thomas	|  School of Information, 301 Hatcher North
   JSTOR / UMDL	 	|  Univ of Michigan, Ann Arbor, MI 48109-1205
spencer@umich.edu	|  313-764-5099, FAX 313-764-2475

========== end forwarded article.

--
 Ken Alexander          JSTOR / UMDL                +1 313 647 6316 
 kalex@umich.edu        University of Michigan      +1 313 647 6897 fax