php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28709 Call to the function pg_last_error kill apache process.
Submitted: 2004-06-09 12:46 UTC Modified: 2004-06-19 01:00 UTC
From: info at sosulka dot ru Assigned:
Status: No Feedback Package: PostgreSQL related
PHP Version: 4.3.6 OS: FreeBsd 4.9
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: info at sosulka dot ru
New email:
PHP Version: OS:

 

 [2004-06-09 12:46 UTC] info at sosulka dot ru
Description:
------------
Call to the function pg_last_error kill apache process. It continue working and eat so much resources. No reply to the user brouser.

Reproduce code:
---------------
    function Query($query) {
    
        if ($query == '') return 0;
        $this->_Query = $query;
        if (!$this->Connect()) return 0;
        if ($this->_QueryId) $this->Free();
       
        if ($this->mDebug) print 'Debug: query = ' . $query . "<br>\n";
       
        $this->_QueryId = pg_query($this->_LinkId, $query);
        $this->mRow   = 0;

# !!!!!! next line error!!!
       $this->mError = pg_last_error($this->_LinkId);
# !!!!!!

        if (!$this->_QueryId) $this->_Halt("Invalid SQL: " . $query);
       
        return $this->_QueryId;
    }


Actual result:
--------------
It working, but sometimes this code kill apache!!! Session destroied.

This normal load:
-bash-2.05b$ uptime
 2:34PM  up 17 days, 22:44, 1 user, load averages: 0,00 0,00 0,00

This load after erorr:
-bash-2.05b$ uptime
 2:34PM  up 17 days, 22:44, 1 user, load averages: 30,00 30,00 30,00
and much


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-09 12:48 UTC] info at sosulka dot ru
function _Halt($msg) {
        $this->mError = pg_last_error($this->_LinkId);
        
        if ($this->mErrHandler != '') {
            $text = "Database Error occured!\n\nQuery:\n" . $this->_Query . "\n\nError:\n" . $this->mError .
                    "\n\nError No:\n" . $this->mErrno;
            $f = $this->mErrHandler;
            $f($text);
        }
	          
        if ($this->mHaltOnError == 'no') return;
        
        $this->_HaltMsg($msg);
        
        if ($this->mHaltOnError != 'report') die('Session halted.');
    }
  
    function _HaltMsg($msg) {
        print '<b>Database error:</b> ' . $msg . "<br>\n";
        print '<b>PgSQL Error</b>: ' . $this->mErrno . ' (' . $this->mError . ")<br>\n";
    }
 [2004-06-09 12:55 UTC] tony2001@php.net
Please, provide a short & clean reproduce script.
Read this: http://bugs.php.net/how-to-report.php before reporting.
Include a backtrace, if you Apache is crashing (read here: http://bugs.php.net/bugs-generating-backtrace.php how to get a backtrace, using gdb).
 [2004-06-19 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 10:01:28 2024 UTC