Bug #71600 [Com]: oci_get_all results in segfault on apache 2.4

From: Date: Wed, 17 Feb 2016 02:03:14 +0000
Subject: Bug #71600 [Com]: oci_get_all results in segfault on apache 2.4
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199283@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71600&edit=1

 ID:                 71600
 Comment by:         nick dot saraniti at gmail dot com
 Reported by:        nick dot saraniti at gmail dot com
 Summary:            oci_get_all results in segfault on apache 2.4
 Status:             Open
 Type:               Bug
 Package:            Oracle related
 Operating System:   CentOS 7.2.1511
 PHP Version:        7.0.3
 Block user comment: N
 Private report:     N

 New Comment:

Some more info, 
Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
"CORE	11.2.0.1.0	Production"
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production

Used rpm to install instaclient's, PECL for oci8

[New Thread 0x7ffff7f396c0 (LWP 7676)]

Program received signal SIGSEGV, Segmentation fault.
0x00007fffea529df5 in _zend_hash_index_update ()
   from /etc/httpd/modules/libphp7.so
(gdb)
(gdb) bt
#0  0x00007fffea529df5 in _zend_hash_index_update ()
   from /etc/httpd/modules/libphp7.so
#1  0x00007fffddd3c395 in zif_oci_fetch_all (execute_data=<optimized out>,
    return_value=0x7fffe8217500) at /var/tmp/oci8/oci8_interface.c:1495
#2  0x00007fffea50b35b in dtrace_execute_internal ()
   from /etc/httpd/modules/libphp7.so
#3  0x00007fffea596db3 in ?? () from /etc/httpd/modules/libphp7.so
#4  0x00007fffea558fcb in execute_ex () from /etc/httpd/modules/libphp7.so
#5  0x00007fffea50b239 in dtrace_execute_ex ()
   from /etc/httpd/modules/libphp7.so
#6  0x00007fffea596a90 in ?? () from /etc/httpd/modules/libphp7.so
#7  0x00007fffea558fcb in execute_ex () from /etc/httpd/modules/libphp7.so
#8  0x00007fffea50b239 in dtrace_execute_ex ()
   from /etc/httpd/modules/libphp7.so
#9  0x00007fffea5a0378 in ?? () from /etc/httpd/modules/libphp7.so
#10 0x00007fffea558fcb in execute_ex () from /etc/httpd/modules/libphp7.so
#11 0x00007fffea50b239 in dtrace_execute_ex ()
   from /etc/httpd/modules/libphp7.so
#12 0x00007fffea5a0378 in ?? () from /etc/httpd/modules/libphp7.so
#13 0x00007fffea558fcb in execute_ex () from /etc/httpd/modules/libphp7.so
#14 0x00007fffea50b239 in dtrace_execute_ex ()
   from /etc/httpd/modules/libphp7.so
#15 0x00007fffea5a2cef in zend_execute () from /etc/httpd/modules/libphp7.so
#16 0x00007fffea51af63 in zend_execute_scripts ()
  from /etc/httpd/modules/libphp7.so
#17 0x00007fffea4bc3a8 in php_execute_script ()
   from /etc/httpd/modules/libphp7.so
#18 0x00007fffea5a46ad in ?? () from /etc/httpd/modules/libphp7.so
#19 0x0000555555593270 in ap_run_handler ()
#20 0x00005555555937b9 in ap_invoke_handler ()
#21 0x00005555555a7b3a in ap_process_async_request ()
#22 0x00005555555a7e14 in ap_process_request ()
#23 0x00005555555a47a2 in ?? ()
#24 0x000055555559c840 in ap_run_process_connection ()
#25 0x00007fffeda1980f in ?? () from /etc/httpd/modules/mod_mpm_prefork.so
#26 0x00007fffeda19a0c in ?? () from /etc/httpd/modules/mod_mpm_prefork.so
#27 0x00007fffeda1a791 in ?? () from /etc/httpd/modules/mod_mpm_prefork.so
#28 0x00005555555795ae in ap_run_mpm ()
#29 0x0000555555572b36 in main ()


Previous Comments:
------------------------------------------------------------------------
[2016-02-15 19:03:42] nick dot saraniti at gmail dot com

Reproduced on Centos 7/ PHP 7 / Apache 2.4

------------------------------------------------------------------------
[2016-02-15 16:07:19] nick dot saraniti at gmail dot com

Sample Code
$SQL="SELECT a.COST_ID, ".
"TO_CHAR(a.CHANGE_DATE, 'MM/DD/YYYY') AS ENTERED_HUMAN, ".
"b.NAME AS DRUG_NAME, ".
"a.PRICE_WAC, a.PRICE_ACQ, a.OLD_WAC, a.OLD_ACQ, a.PRICE_AWP, a.OLD_AWP, ".
"CASE " . 
"WHEN (b.drugndctype = 48 ) THEN b.DRUGNDCNBR  " . 
"WHEN (b.drugndctype = 57 ) THEN b.DRUGNDCNBR  " . 
"WHEN (b.drugndctype = 53 ) THEN b.DRUGNDCNBR  " . 
"WHEN (b.drugndctype = 51 ) THEN SUBSTR(b.DRUGNDCNBR, 1, 5)||LPAD(SUBSTR(b.DRUGNDCNBR, 6, 3),
4, '0')||SUBSTR(b.DRUGNDCNBR, -2, 2) " . 
"WHEN (b.drugndctype = 52 ) THEN SUBSTR(b.DRUGNDCNBR, 0, 9)||LPAD(SUBSTR(b.DRUGNDCNBR, -1, 1),
2, '0')  " . 
"WHEN (b.drugndctype = 54 ) THEN b.DRUGNDCNBR  " . 
"WHEN (b.drugndctype = 55 ) THEN b.DRUGNDCNBR  " . 
"WHEN (b.drugndctype = 49 ) THEN b.DRUGNDCNBR  " . 
"WHEN (b.drugndctype = 56 ) THEN LPAD(b.DRUGNDCNBR, 11, '0')  " . 
"WHEN (b.drugndctype = 50 ) THEN LPAD(b.DRUGNDCNBR, 11, '0')  " . 
"END AS NDC, " . 
"a.CHANGE_REASON ".
"FROM HDS_STATS_COST a ".
"LEFT OUTER JOIN DRUG b on (a.DRUGSTORE=b.DRUGNBRSTOREID AND a.DRUGKEY = b.DRUGNBRKEY) ".
"WHERE a.REVIEW_DATE is null ".
"ORDER BY a.CHANGE_DATE DESC";
$stmt = oci_parse($GLOBALS['dbConx'], $SQL);
oci_execute($stmt, OCI_DEFAULT);
oci_fetch_all($stmt, $result);
return ($result);
oci_free_statement($stmt);

------------------------------------------------------------------------
[2016-02-15 15:54:46] nick dot saraniti at gmail dot com

Description:
------------
In some cases oci_fetch_all causes apache 2.4/centos7 to segfault.  Happens consistently on some
pages, never on others calling same function.  Possible something related to the SQL queries?

Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
0x00007fffea529df5 in _zend_hash_index_update () from /etc/httpd/modules/libphp7.so
(gdb) bt
#0  0x00007fffea529df5 in _zend_hash_index_update () from /etc/httpd/modules/libphp7.so
#1  0x00007fffddd3c785 in zif_oci_fetch_all (execute_data=<optimized out>,
return_value=0x7fffe8218500) at /var/tmp/oci8/oci8_interface.c:1495
#2  0x00007fffea50b35b in dtrace_execute_internal () from /etc/httpd/modules/libphp7.so
#3  0x00007fffea596db3 in ?? () from /etc/httpd/modules/libphp7.so
#4  0x00007fffea558fcb in execute_ex () from /etc/httpd/modules/libphp7.so
#5  0x00007fffea50b239 in dtrace_execute_ex () from /etc/httpd/modules/libphp7.so
#6  0x00007fffea596a90 in ?? () from /etc/httpd/modules/libphp7.so
#7  0x00007fffea558fcb in execute_ex () from /etc/httpd/modules/libphp7.so
#8  0x00007fffea50b239 in dtrace_execute_ex () from /etc/httpd/modules/libphp7.so
#9  0x00007fffea5a0378 in ?? () from /etc/httpd/modules/libphp7.so
#10 0x00007fffea558fcb in execute_ex () from /etc/httpd/modules/libphp7.so
#11 0x00007fffea50b239 in dtrace_execute_ex () from /etc/httpd/modules/libphp7.so
#12 0x00007fffea5a0378 in ?? () from /etc/httpd/modules/libphp7.so
#13 0x00007fffea558fcb in execute_ex () from /etc/httpd/modules/libphp7.so
#14 0x00007fffea50b239 in dtrace_execute_ex () from /etc/httpd/modules/libphp7.so
#15 0x00007fffea5a2cef in zend_execute () from /etc/httpd/modules/libphp7.so
#16 0x00007fffea51af63 in zend_execute_scripts () from /etc/httpd/modules/libphp7.so
#17 0x00007fffea4bc3a8 in php_execute_script () from /etc/httpd/modules/libphp7.so
#18 0x00007fffea5a46ad in ?? () from /etc/httpd/modules/libphp7.so
#19 0x0000555555593270 in ap_run_handler ()
#20 0x00005555555937b9 in ap_invoke_handler ()
#21 0x00005555555a7b3a in ap_process_async_request ()
#22 0x00005555555a7e14 in ap_process_request ()
#23 0x00005555555a47a2 in ?? ()
#24 0x000055555559c840 in ap_run_process_connection ()
#25 0x00007fffeda1980f in ?? () from /etc/httpd/modules/mod_mpm_prefork.so
#26 0x00007fffeda19a0c in ?? () from /etc/httpd/modules/mod_mpm_prefork.so
#27 0x00007fffeda1a791 in ?? () from /etc/httpd/modules/mod_mpm_prefork.so
#28 0x00005555555795ae in ap_run_mpm ()
#29 0x0000555555572b36 in main ()


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=71600&edit=1


Thread (19 messages)

« previous php.bugs (#199283) next »