php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27978 PHP Causing Apache to Abort?
Submitted: 2004-04-13 10:01 UTC Modified: 2004-04-19 12:22 UTC
From: megan dot boardman at rweinnogy dot com Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 4.3.5 OS: UNIX 5.1 ALPHA
Private report: No CVE-ID: None
 [2004-04-13 10:01 UTC] megan dot boardman at rweinnogy dot com
Description:
------------
Since upgrading to PHP 4 have been experiencing problems with Apache 1.3.26 periodically appearing to crash.  This has gradually gotten worse as we have worked our way up through the 4.x generation of PHP. 

Timeline goes as follows (based on messages in Apache error_log):

- PHP 4.0.4pl1 gave occasional child XXXX exit signal Segmentation Fault (11).

- PHP 4.1.2 gave no errors.

- PHP 4.3.3, 4.3.4 and 4.3.5 gave frequent child XXXXX exit signal Abort (6) errors

This PHP script is being used to submit requests to a database.  This "aborting" behaviour appears to be causing the sending web browser to lose contact with Apache, and hence send the form post multiple times.  The PHP script always appears to get as far as sending the submission to the database, but then falls over before sending the response back to the web server.  Result -> multiple duplicate database submissions, occasional "Page Not Found" 505 errors in the web browser.

Working with an Oracle 8 database and mod_fastcgi 2.2.12

Reproduce code:
---------------
Cannot easily reproduce code, however general form is as follows:

1) Create object that contains contents of HTML page being constructed

2) Pass object by reference to function

3) Function builds database submission (based on variables that have been POSTed by a previous web form submision) and then sends an email, sets a cookie and builds HTML based on result from database.

4) Function ends and web page printed to screen

- DB Submission always happens
- Email always happens
- Apache appears to fall over before the cookie gets set and before the HTML gets displayed

NOTE:
- Seems order invarient.
- Methodology applied for earlier webforms posts, and works without multiple submissions.


Expected result:
----------------
- DB Submission 
- Email to be sent
- Cookie set in browser
- Resultant HTML posted to screen

Actual result:
--------------
- DB submission
- Email sent
- Cookie & HTML display do NOT necessarily occur

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-13 12:30 UTC] sniper@php.net
This report is as useful as not reporting anything. Please come up with SOLID reproducing script and how to reproduce.
(and note: We don't have any access to any alpha machines..aren't those some relic anyway? Get new machine? :)

 [2004-04-19 12:22 UTC] megan dot boardman at rweinnogy dot com
I've managed to trace this to a problem with the Oracle functions.  i.e. I get no aborts in the Apache log until I try using OCILogon() to actually try to connect to the database.

Could this be related to needing pthread linked in Apache (www.php.net/manual/en/ref.oc18.php)?

I recognise that supporting legacy systems is difficult, but the reality is that these systems do still exist and upgrading is not always an option.  Would be helpful if you could at least list what you are prepared to test against, and what systems you claim compatibility with.

For what it's worth example code is given below (need to fill in relevant database, email, and db query).  Behaviour I see is:
- With all database related calls commented out, I get one email, the cookie gets set and I always get the data printed to the web browser).
- With database calls in, I sometimes get multiple emails, muliple database submissions and may or may not get the cookie / HTML data back at the browerser end.  When this poor behaviour occurs it coincides with an Abort(6) error in the Apache log.



<?php

function callFunction(&$doc, &$a) {

  $Database = "xxxx";

  // Connect to database and get unique key - simulate here by assigning key
  $conn = OCILogon("xxxx", "xxxx", $Database);
  $returnArray = array();
  $cursor = OCIParse($conn, "select user_reports_seq.NEXTVAL from dual");
  $ret = OCIExecute($cursor, OCI_DEFAULT);
  if ($ret) {
      OCIFetchStatement($cursor, &$returnArray);
      OCICommit($conn);
  } else {
      OCIRollback($conn);
  }
  OCIFreeStatement($cursor); 
  OCILogOff($conn);

  $row = $returnArray["NEXTVAL"];
  $keys = array_keys($row);
  $Key = $row[array_pop($keys)];

  if ($ret) {
      // Send notification message
      $message = "Fault report " . $Key . " requires your attention.";
      mail("xxxx.xxxx@xxxx.com", " Fault Report - " . $Key, $message, "From: xxxx@xxxx.com");
             
      // Present message to user
      $doc[$a++] = "<p>Submission Successful!</p>";
      $doc[$a++] = "<p>The system reference number for your report is <b>$Key</b>.</p>"; 
      SetCookie("Submitted", $Key);
             
   } else {
       $doc[$a++] = "<p>Submission failed</p>";
   }
}


$doc = array();
$a = 0;
$doc[$a++] = "<html><head><title>Test PHP Page</title></head><body>";

callFunction($doc, $a);

$doc[$a++]="</body></html>";
foreach($doc as $data) {
    print $data;
}

?>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Sep 18 19:01:28 2024 UTC