Bug #66283 [Opn]: Segmentation fault

From: Date: Thu, 19 Dec 2013 04:04:38 +0000
Subject: Bug #66283 [Opn]: Segmentation fault
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183396@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66283&edit=1

 ID:                 66283
 Updated by:         laruence@php.net
 Reported by:        jan dot kahoun at heureka dot cz
 Summary:            Segmentation fault
 Status:             Open
 Type:               Bug
 Package:            MySQLi related
 Operating System:   Centos 6.2
 PHP Version:        5.4.22
 Block user comment: N
 Private report:     N

 New Comment:

can not reproduce it with libmysql either.. btw do you use xdebug in the mean time?


Previous Comments:
------------------------------------------------------------------------
[2013-12-19 03:56:21] laruence@php.net

libmysql or mysqlnd, I can not reproduce it with mysqlnd

------------------------------------------------------------------------
[2013-12-18 08:18:20] jan dot kahoun at heureka dot cz

We tried newest version of PHP 5.4.23 and problem still persists.

------------------------------------------------------------------------
[2013-12-15 17:15:42] jan dot kahoun at heureka dot cz

Try this new version of the test code. Just create table in MySQL and insert the test data. Then run
the test script, with filled your database setting (user, password and database name) e.g. from CLI.


Database setup:

CREATE TABLE IF NOT EXISTS Test (
    id int(10) unsigned NOT NULL AUTO_INCREMENT,
    parentId smallint(5) unsigned NOT NULL,
    seoId varchar(255) COLLATE utf8_czech_ci NOT NULL,
    name varchar(255) COLLATE utf8_czech_ci NOT NULL,
    PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
        
INSERT INTO Test (id, parentId, seoId,
name)
values('1','1','seoId','name'),('2','1','seoId','name');


PHP test script:

<?php
ini_set('memory_limit', '1M');
$mysqli = mysqli_init();
// set your database setting here by replacing default values 'user',
'password', 'dbname'
$mysqli->real_connect('127.0.0.1', 'user', 'password',
'dbname', 'port');

$sql = str_repeat("SELECT * FROM Test LIMIT 100; SELECT * FROM Test LIMIT 100;", 300);
$mysqli->multi_query($sql);
$retArr = array();
do {
	if ($res = $mysqli->store_result()) {
    $ret = array();
    while ($row = $res->fetch_assoc()) {
      $ret[] = $row;
    }
    $res->free();
    $retArr[] = $ret;
  }
} while ($mysqli->next_result()); 
?>

Actual result:

PHP Fatal error:  Allowed memory size of 1048576 bytes exhausted (tried to allocate 6 bytes) in
/home/web/index.php on line 16
PHP Stack trace:
PHP   1. {main}() /home/web/index.php:0
PHP   2. mysqli_result->free() /home/web/index.php:16

Fatal error: Allowed memory size of 1048576 bytes exhausted (tried to allocate 6 bytes) in
/home/web/index.php on line 16

Call Stack:
    0.0002     234568   1. {main}() /home/web/index.php:0
    0.0273    1046488   2. mysqli_result->free() /home/web/index.php:16

Segmentation fault (core dumped)

Expected result:

Only PHP Fatal error without "Segmentation fault (core dumped)".

------------------------------------------------------------------------
[2013-12-13 18:14:23] krakjoe@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

The reproduce script provided cannot be executed outside of your environment since it contains
custom code, you must provide a script that does not rely on code we cannot use, preferably a script
with no dependencies.

------------------------------------------------------------------------
[2013-12-13 09:27:26] krakjoe@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.



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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=66283


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


Thread (14 messages)

« previous php.bugs (#183396) next »