php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56986 db2_connect() high cpu usage
Submitted: 2006-04-27 16:45 UTC Modified: 2006-05-09 18:27 UTC
From: daniel dot savard at ingcanada dot com Assigned:
Status: Not a bug Package: ibm_db2 (PECL)
PHP Version: 4.3.4 OS: SLES 9
Private report: No CVE-ID: None
 [2006-04-27 16:45 UTC] daniel dot savard at ingcanada dot com
Description:
------------
The db2_connect() consumes most of the CPU when connecting and is somewhat slow.

Also, the test code end with a Segmentation Fault.

Version of ibm_db2.so is: 1.2.1

DB2 is version 8.2 FP 4 (or 8.1 FP 11).

Reproduce code:
---------------
<?php
 
$User = 'myuser';
$Pass = 'mypassword';
$DB = 'opsmon';
 
dl("ibm_db2.so");
$conn = db2_connect($DB, $User, $Pass); 
if ($conn) {  
  echo "Connection to $DB succeeded\n"; 
  db2_close($conn); 
  echo "Connection closed\n"; 
}  
?>


Expected result:
----------------
Connection to $DB succeeded
echo "Connection closed

And CPU consumption below 10%.

Actual result:
--------------
Connection to $DB succeeded
echo "Connection closed
Segmentation Fault


And consumes 99% CPU while a db2 connect to $DB consumes only 2% CPU.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-27 16:58 UTC] kfbombar at us dot ibm dot com
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

Please provide more information including a backtrace on the segfault.  We are not seeing segfaults on simple connections on Linux (or any other supported platform).  Please provide more info and we will look further into it.
 [2006-05-01 16:41 UTC] daniel dot savard at ingcanada dot com
I apologize for this bug report. I haven't compiled and installed myself the DB2 module and it simply appears the job has not been done right.

I downloaded the PHP 4.3.4 source and compiled with --enable-debug in order to produce the backtrace. I then recompiled with ibm_db2.so extension and I no longer get a Segmentation fault and coredump.

However, the connect to the database still consumes all CPU for about 5 seconds which is amazingly high compare to the db2 connect to db_name command from the command line which never consumes more than 5% of CPU resources for a very short time.
 [2006-05-02 14:45 UTC] daniel dot savard at ingcanada dot com
After some discussion, we decided to try to identify where the Segmentation fault problem takes root. I then recompiled the ibm_db2.so module using the vanilla php packaged with SLES 9 and the problem just reappears. So, seems the problem is due to the php rpm from SuSe/Novell.

I even recompiled PHP without the debugging and it is working properly. The problem occurs only with the SuSe PHP rpm.
 [2006-05-09 18:27 UTC] kfbombar at us dot ibm dot com
Sorry, but your problem does not imply a bug in PECL itself.  For a
list of more appropriate places to ask for help using PECL, please
visit http://pecl.php.net/support/ as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PECL.

Closed due to segfault not appearing anymore.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 22:01:29 2024 UTC