Bug #61411 [Com]: PDO Segfaults with PERSISTENT == TRUE && EMULATE_PREPARES == FALSE

From: Date: Fri, 14 Jul 2017 15:30:27 +0000
Subject: Bug #61411 [Com]: PDO Segfaults with PERSISTENT == TRUE && EMULATE_PREPARES == FALSE
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210058@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61411&edit=1

 ID:                 61411
 Comment by:         ashokcsenitj16 at gmail dot com
 Reported by:        julien at palard dot fr
 Summary:            PDO Segfaults with PERSISTENT == TRUE &&
                     EMULATE_PREPARES == FALSE
 Status:             Re-Opened
 Type:               Bug
 Package:            PDO MySQL
 Operating System:   Linux 2.6.32-5-amd64
 PHP Version:        5.4.0
 Assigned To:        uw
 Block user comment: N
 Private report:     N

 New Comment:

Hi All,

I am getting following error 

SQLSTATE[HY000]: General error: 1615 Prepared statement needs to be re-prepared

with PDO::ATTR_PERSISTENT => TRUE, PDO::ATTR_EMULATE_PREPARES => FALSE

Can anyone please help me in this?


Previous Comments:
------------------------------------------------------------------------
[2015-06-25 15:19:17] nachms+php at gmail dot com

I ran all the various tests here, and could not recreate any issues. I've even forcefully
restarted MySQL in the middle of a script running to see what would happen, and things went fine.

I'm using:
PHP 5.6.9-1 (cli) (built: May 22 2015 10:48:57)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with XCache v3.2.0, Copyright (c) 2005-2014, by mOo
    with Suhosin v0.9.37.1, Copyright (c) 2007-2014, by SektionEins GmbH
    with XCache Optimizer v3.2.0, Copyright (c) 2005-2014, by mOo
    with XCache Cacher v3.2.0, Copyright (c) 2005-2014, by mOo
    with XCache Coverager v3.2.0, Copyright (c) 2005-2014, by mOo

With the mysqlnd extension and mysql Ver 14.14 Distrib 5.5.43, for debian-linux-gnu (x86_64) using
readline 6.3.

Aside from the original reporter, no one specified which MySQL extension they were using, so
it's possible certain bugs exist in certain versions with a certain extension, but it's
unclear which exactly.

------------------------------------------------------------------------
[2015-01-15 10:38:54] fundom02 at yahoo dot com

Don,

That's interesting. Have you tried my code with settings your MySQL timeout less than than the
sleep?

function create_connection(){
		$options = array(PDO::ATTR_PERSISTENT => TRUE,PDO::ATTR_EMULATE_PREPARES => FALSE); 
		return new PDO('mysql:host=127.0.0.1;dbname=trafficadbar;charset=utf8',
		    'root', 'wnn99BCc', $options);
	    }


	    $pdo = create_connection();
	    sleep(5);
	    $pdo1 = create_connection();

	    $statement = $pdo1->prepare("SELECT count(*) from users");
	    $statement->execute();
	    foreach ($statement as $line)
		var_dump($line);

------------------------------------------------------------------------
[2015-01-14 22:05:43] don at smugmug dot com

We've been running with PERSISTENT = TRUE && EMULATE_PREPARES = FALSE on our testbed
since December 23rd, with no segfaults or any other problems with connections, including the ones
described by Fundom02.  We'll likely push this change to production shortly.

------------------------------------------------------------------------
[2015-01-14 18:24:50] Fundom02 at yahoo dot com

I get an error, caused by php returning a cached connection that's expired.

If you run my code you will see the problem.

------------------------------------------------------------------------
[2015-01-14 18:17:23] mike@php.net

Are you experiencing a crash?

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


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=61411


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


Thread (21 messages)

« previous php.bugs (#210058) next »