Bug 88611 - Processes started via CGI die when httpd dies
Processes started via CGI die when httpd dies
Status: CLOSED CANTFIX
Product: Red Hat Linux
Classification: Retired
Component: postgresql (Show other bugs)
9
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tom Lane
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-04-11 09:17 EDT by Sepp Rudel
Modified: 2013-07-02 22:59 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-10-18 14:08:17 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Sepp Rudel 2003-04-11 09:17:43 EDT
Description of problem:

Using a simple perl script:

#!/usr/bin/perl
if ($< ne 0)
{
         exec ("sudo /var/www/cgi-bin/test.cgi");
}
print "Content-Type: text/html\n\n";
system("/etc/init.d/postgresql stop");
sleep 5;
system("/etc/init.d/postgresql start");
sleep 10;
system("/etc/init.d/httpd restart");
exit 0;

works perfecty when executed from command line (as root or via sudo). But when
executing via apache/cgi/sudo, postgres/postmaster processes die instantly when
httpd is stopped.


Version-Release number of selected component (if applicable):

Version from RHL7.3+errata.


How reproducible:

Always.


Steps to Reproduce:
1. Create the script above
2. Tweak sudo
3. Run it via apache/cgi


Actual results:

PostgreSQL dies when httpd is stopped.


Expected results:

PostgreSQL continues running when httpd is stopped.


Additional info:

This problem is seems to exists with ucd-snmp as well - it seems that this is
somehow related to the fact the PostgreSQL and ucd-snmp both use su in their
init scripts. Any patches/workarounds/comments would be highly appreciated.
Comment 1 Sepp Rudel 2003-05-06 02:41:37 EDT
The problem exists with RHL9, too. The difference between RHL7.3 and RHL9 is
that with RHL7.3 httpd restart is completed, with RHL9 not (i.e., httpd is only
stopped). But the main point is that why PostgreSQL dies?
Comment 2 Sepp Rudel 2003-06-02 03:15:19 EDT
So, any news on this one? Or is this the right component?
Comment 3 Sepp Rudel 2003-07-03 09:57:07 EDT
Trying my luck with another component.
Comment 4 Sepp Rudel 2003-08-18 07:36:01 EDT
Any news from this? A sole "RTFM" comment would be warmly welcomed, if that's
all what's needed!
Comment 5 Joe Orton 2003-12-01 09:29:41 EST
What user is the CGI script running as?  Unless it's root (which you
shouldn't run CGI scripts as) this is probably never going to work
properly.
Comment 6 Tom Lane 2004-04-05 16:24:47 EDT
I would guess that this is somehow making the postmaster part of the
process group for httpd, and that the shutdown method used for httpd
sends SIGTERM to the whole process group.  (Seems a bit odd though
since I'd have thought spawning via "su -c" would put the child
process into its own group.)

If this theory is correct then adding -S to the postmaster switches in
the PG start script (put it in the -o stuff in the pg_ctl start call)
might make the difficulty go away.  I'm not familiar enough with httpd
to ensure I'm reproducing your test case --- could you try this and
see?

Note that I'd not want to make this change to the official script, as
it would interfere with plans to support logging to stderr better. 
However it might do as a workaround, and anyway we need to be sure we
understand the cause of the problem before thinking about "real"
solutions.
Comment 7 Bill Nottingham 2006-10-18 14:08:17 EDT
Red Hat Linux is no longer supported by Red Hat, Inc. If you are still
running Red Hat Linux, you are strongly advised to upgrade to a
current Fedora Core release or Red Hat Enterprise Linux or comparable.
Some information on which option may be right for you is available at
http://www.redhat.com/rhel/migrate/redhatlinux/.

Red Hat apologizes that these issues have not been resolved yet. We do
want to make sure that no important bugs slip through the cracks.
If this issue is still present in a current Fedora Core release, please
open a new bug with the relevant information.

Closing as CANTFIX.

Note You need to log in before you can comment on or make changes to this bug.