php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57356 Segmentation fault
Submitted: 2006-11-08 10:43 UTC Modified: 2007-03-06 11:03 UTC
From: jorn dot kulessa at tietoenator dot com Assigned:
Status: Closed Package: ibm_db2 (PECL)
PHP Version: 5.1.2 OS: OpenSuse 10.1
Private report: No CVE-ID: None
 [2006-11-08 10:43 UTC] jorn dot kulessa at tietoenator dot com
Description:
------------
After compiling ibm_db2 as follows:
php5 /usr/share/php5/PEAR/peclcmd.php install ~/ibm_db2-1.5.1.tgz
(pecl not available on OpenSuse)

and included the extension into the php.ini
a test script runs into a Segmentation fault.
php5 db2_con.php -> see Actual result

Reproduce code:
---------------
$conn = db2_connect($database, $user, $password);

if ($conn) {
   echo "Connection succeeded.\n";
        $client = db2_client_info( $conn );

if ($client) {
   echo "DRIVER_NAME: ";        var_dump( $client->DRIVER_NAME );
   echo "DRIVER_VER: ";        var_dump( $client->DRIVER_VER );
   echo "DATA_SOURCE_NAME: ";        var_dump( $client->DATA_SOURCE_NAME );
   echo "DRIVER_ODBC_VER: ";        var_dump( $client->DRIVER_ODBC_VER );
   echo "ODBC_VER: ";            var_dump( $client->ODBC_VER );
   echo "ODBC_SQL_CONFORMANCE: ";    var_dump( $client->ODBC_SQL_CONFORMANCE );
   echo "APPL_CODEPAGE: ";        var_dump( $client->APPL_CODEPAGE );
   echo "CONN_CODEPAGE: ";        var_dump( $client->CONN_CODEPAGE );
}
   db2_close($conn);


Expected result:
----------------
Connection succeeded
...



Actual result:
--------------
 gdb php5
GNU gdb 6.4
Copyright 2005 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i586-suse-linux"...(no debugging symbols found)
Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) run db2_con.php
Starting program: /usr/bin/php5 db2_con.php
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread -1213282640 (LWP 8507)]
Connection succeeded.
DRIVER_NAME: string(8) "libdb2.a"
DRIVER_VER: string(10) "08.02.0003"
DATA_SOURCE_NAME: string(6) "SESYS2"
DRIVER_ODBC_VER: string(5) "03.51"
ODBC_VER: string(10) "03.01.0000"
ODBC_SQL_CONFORMANCE: string(8) "EXTENDED"
APPL_CODEPAGE: int(819)
CONN_CODEPAGE: int(819)
 

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1213282640 (LWP 8507)]
0xb6b2add0 in ?? ()
(gdb) bt
#0  0xb6b2add0 in ?? ()
#1  0x08350100 in ?? ()
#2  0x00000000 in ?? ()
(gdb) q
The program is running.  Exit anyway? (y or n) y


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-13 10:40 UTC] kfbombar at us dot ibm dot com
This is a known bug with DB2 and can be fixed in a number of ways.  Your first choice is to use the DB2 thin client.  Your secaiond choice is to wt until the next FixPack comes out for v8.  Your third choice is to use the v9 FixPack 2 that will be coming out soon.

Your quickest route would be to use the thin-client.  Please contact your IBM representative for release times for the above FixPack's and locations for downloads.
 [2007-03-01 10:10 UTC] tba at goyellow dot de
I tried it with the new v9 FixPack 2 but the problem persists.
 [2007-03-01 10:27 UTC] kfbombar at us dot ibm dot com
I have tested this on Suse with DB2 v9 FP2 and the latest IBM_DB2 and am not seeing any issues.  Here is my output from your script:

$ php a.php
Connection succeeded.
DRIVER_NAME: string(8) "libdb2.a"
DRIVER_VER: string(10) "09.01.0002"
DATA_SOURCE_NAME: string(4) "DB2"
DRIVER_ODBC_VER: string(5) "03.51"
ODBC_VER: string(10) "03.01.0000"
ODBC_SQL_CONFORMANCE: string(8) "EXTENDED"
APPL_CODEPAGE: int(1208)
CONN_CODEPAGE: int(1208)

Have you recompiled the driver against the new DB2 v9 FP2 libraries?
 [2007-03-05 12:25 UTC] tba at goyellow dot de
I installed one again everything and then recompiled the library. 

A simple connect or even SELECTS are ok but I get the
segmentation fault when i'm calling StoredProcedures with OUT parameters (Prepare-Bind-Execute).
 [2007-03-05 12:37 UTC] kfbombar at us dot ibm dot com
When you recompiled IBM_DB2, did you link it against the new DB2 v9 FP2 libraries?  For example, did you...

./configure --with-IBM_DB2=/path/to/DB2/v9/FP2
 [2007-03-06 04:05 UTC] tba at goyellow dot de
I installed at first the DB2 9 Client (to have a client and the header files for compilation) then the Runtime Client (to be able to use ibm_db2) and then the UniversalFixpack 2 (in the same directory as the clients /opt/ibm/db2/V9.1 )

I compiled then the package ibm_db2-1.6.0 with:

phpize
./configure --with-IBM_DB2=/opt/ibm/db2/V9.1
make
 [2007-03-06 11:03 UTC] kfbombar at us dot ibm dot com
Please try sourcing your db2profile (or db2cshrc depending on your shell) prior to the phpize/configure/make/make install.  Let me know if that helps.  Thanks,
 [2007-03-09 05:29 UTC] tba at goyellow dot de
It works!

The problem was that I'm porting a complex application to
PHP 5 and DB2 8/9 and a software bug under PHP 5 caused a similar Segmentation Fault at exit as the DB2.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Sep 16 14:01:28 2019 UTC