Bug 39332

Summary: mod_cgid does not work with worker MPM on Solaris
Product: Apache httpd-2 Reporter: Masaoki Kobayashi <masaoki>
Component: mod_cgidAssignee: Apache HTTPD Bugs Mailing List <bugs>
Severity: major CC: lovan, rahul.g.nair
Priority: P2 Keywords: FixedInTrunk, PatchAvailable
Version: 2.2.0   
Target Milestone: ---   
Hardware: All   
OS: Solaris   
Attachments: Fix the intermittent SIGSEGV in mod_cgid on Solaris 10

Description Masaoki Kobayashi 2006-04-18 07:01:50 UTC
Using with worker MPM, mod_cgid fails to launch CGI program.  This also happens 
on httpd 2.0.55, however, it sometimes works there.  i.e. All execution on 
2.2.x fails on Solaris worker MPM, while about a half of them fails on 2.0.x on 
Solaris worker MPM.  No problem with prefork MPM and mod_cgi.
It is observed on Solaris 10 x86 64 bit kernel with 64 bit httpd binary.  I did 
not check it on 32 bit environment.  I will debug it into details later.

The error_log shows the following lines.

[Tue Apr 18 15:47:19 2006] [error] [client] Premature end of 
script headers: printenv
[Tue Apr 18 15:47:19 2006] [error] [client] (3)No such process: 
cgid daemon is gone; is Apache terminating?: /var/apache2/cgi-bin/printenv
[Tue Apr 18 15:47:19 2006] [notice] child pid 8121 exit signal Segmentation 
fault (11)
[Tue Apr 18 15:47:19 2006] [error] cgid daemon process died, restarting
Comment 1 Ruediger Pluem 2006-04-18 21:07:48 UTC
Have you applied Patch #120665 to Solaris? There is a known problem with Unix
domain sockets on Solaris 10 without this patch.
Comment 2 Masaoki Kobayashi 2006-04-24 02:49:45 UTC
I tried patch #120665 (and also the latest patch cluster), it changes nothing 
however.  Let me have time to look into details.
Comment 3 Masaoki Kobayashi 2006-04-24 05:21:45 UTC
My former message was not correct.  The thing now changes that it sometimes 
happens, not always.
In my v20z Solaris 10 x86 (amd64) box, the apache 2.2.2 sometimes fails to 
launch the CGI.  When I added some debug codes inside sock_read()/sock_write() 
inside mod_cgid.c, the order of read/write sometimes changes, which causes 
SIGSEGV inside cgid server.
I now guess this may be a Solaris fault because my v20z box has 2 dual core 
processors (total 4 cores), which can cause a race condition inside the 
multithreaded kernel.
I created a patch to fix this problem.  This is a passive approach in order to 
avoid the Solaris suspicious behavior, but works fine.
Comment 4 Masaoki Kobayashi 2006-04-24 05:27:28 UTC
Created attachment 18160 [details]
Fix the intermittent SIGSEGV in mod_cgid on Solaris 10

This patch eliminates the intermittent SIGSEGV in mod_cgid on Solaris 10.  I am
not sure about writev() and stdargs compatibility among many platforms.
Comment 5 Nick Kew 2008-12-26 18:08:40 UTC
*** Bug 34264 has been marked as a duplicate of this bug. ***
Comment 6 Nick Kew 2008-12-26 18:15:14 UTC
Fixed in trunk - r729579.
Thanks for the patch!
Comment 7 Nick Kew 2009-01-06 11:22:22 UTC
Patch backported to 2.2 branch in r732067
Comment 8 Rainer Jung 2018-02-25 19:49:42 UTC
*** Bug 34264 has been marked as a duplicate of this bug. ***
Comment 9 Rainer Jung 2018-02-25 21:03:20 UTC
Undo spam change